New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add radio-browser search integration #2108
base: master
Are you sure you want to change the base?
Conversation
Download the artifacts for this pull request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kgarner7 why this is still a draft? Anyway, check my comments. Thanks!
Re: "Translation. Most of the API is English, but it could be possible to translate the country code and language code?", I think it makes sense. We could maybe add the country code in the translation files, and get the translations from there.
conf/configuration.go
Outdated
@@ -276,6 +307,10 @@ func init() { | |||
viper.SetDefault("spotify.secret", "") | |||
viper.SetDefault("listenbrainz.enabled", true) | |||
viper.SetDefault("listenbrainz.baseurl", "https://api.listenbrainz.org/1/") | |||
viper.SetDefault("radiobrowser.baseurl", "https://de1.api.radio-browser.info") | |||
viper.SetDefault("radiobrowser.enabled", "true") | |||
viper.SetDefault("radiobrowser.refreshschedule", "@every 24h") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make the default @weekly
core/agents/radiobrowser/agent.go
Outdated
) | ||
|
||
const ( | ||
fetchAgentTimeout = 100000000000000 // 100s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you set this as a proper duration? 100 * time.Second
core/agents/radiobrowser/agent.go
Outdated
|
||
toDelete := []string{} | ||
|
||
for id := range existing { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can use the utils.RangeByChunks
function here.
model/properties.go
Outdated
@@ -2,7 +2,8 @@ package model | |||
|
|||
const ( | |||
// TODO Move other prop keys to here | |||
PropLastScan = "LastScan" | |||
PropLastScan = "LastScan" | |||
PropLastRefresh = "LastRefresh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename this to PropLastRadioBrowserRefresh
, to be more explicitly ?
core/agents/radiobrowser/agent.go
Outdated
}) | ||
} | ||
|
||
func RadioBrowserConstructor(ds model.DataStore) *radioBrowserAgent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Constructors" in Go, by convention, are named NewXxxx()
;)
|
||
DROP TABLE radio_tmp; | ||
`) | ||
// This code is executed when the migration is applied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this comment.
} | ||
|
||
func downAddCachedRadioinfo(tx *sql.Tx) error { | ||
// This code is executed when the migration is rolled back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this comment.
core/agents/radiobrowser/agent.go
Outdated
maxQueryVariables = 1000 // You can go higher than this, but just a precaution | ||
) | ||
|
||
type RadioBrowserAgent interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this classifies as an "Agent", as it is very specific, probably won't be implemented with other service. But if you feel it can be implemented with other services, then it should not update the DB directly, it should only query the API and return a parsed list of radios. The synchronization with the DB should be done in a core
service.
ui/src/i18n/en.json
Outdated
@@ -366,6 +385,9 @@ | |||
"musicbrainz": "Open in MusicBrainz" | |||
}, | |||
"lastfmLink": "Read More...", | |||
"originalFormat": "Download in original format", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we are using this string in the PR.
ui/src/App.js
Outdated
permissions === 'admin' ? ( | ||
<Resource name="radioInfo" {...radioInfo} /> | ||
) : undefined, | ||
config.devEnableShare && <Resource name="share" {...share} />, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge error?
- Merge in master - `/radio` => `/radios`. For some reason `/radio/${id}` just gave me a status=0? If the original one works that'd be great - Move radio search to empty page/radio list - Edit button for existing entries instead
This was still in draft mainly for the translations (and in the hope that proxying radios would be looked at first). One weird thing I noticed when testing, for some reason |
Do you think the radio proxy PR should go first? |
If possible, yes. My reasoning is that, currently, the internet radio feature basically requires you to have an existing one in mind. With this feature, it makes searching more likely, which while a good thing, also means that the odds of someone finding a stream that doesn't support work currently more likely... |
This PR has been automatically marked as stale because it has not had recent activity. The resources of the Navidrome team are limited, and so we are asking for your help. |
This is a draft integration of the Radio Browser API.
It currently does:
radio
tableThings missing:
[ ] Proxy/store favicons? Some of them set third-party cookies, which isn't nice. Cons: extra load on Navidrome(to be handled in another request)