Repository navigation
Ship corrections for station data - #1604
Merged
Merged
Conversation
The Radio Browser API has no way to edit a station, and its corrections repository has not merged a fix since May 2025. Ship corrections with the library instead: JSON files in a folder per country, in the format of the upstream radio-database repository, matched to stations by UUID. A correction deletes a station or overwrites some of its fields, and station_click() returns the corrected stream URL. Pass corrections=False to get the stations as the API returns them. The first correction removes a duplicate of Radio Odyssey, which its operator asked for upstream.
This was referenced Oct 2, 2026
4 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
None. Corrections are on by default, but they only change stations that have one, and the only one shipped removes a duplicate. Pass
corrections=Falseto get the stations exactly as the API returns them.Proposed change
Radio Browser has no way to edit a station: the API and the website can only add one. Corrections go through merge requests on the radio-database repository, but that has not merged one since May 2025, and 196 are waiting. Users of this library, like everyone using the Radio Browser integration in Home Assistant, are left with stream URLs that moved, broken favicons and duplicates, with nowhere to get them fixed.
So the library now ships corrections of its own, a bit like quirks in ZHA, but as plain data:
reason, and either deletes the station ("delete": true) or overwrites one or more ofname,url,homepage,favicon,tags,countrycode,state,iso_3166_2,language,languagecodes,geo_latandgeo_long.The corrections are read once, on import, so no file is read in the event loop. They are applied to the API response before it becomes
Stationobjects, forstations(),search(),station(),stations_by_uuid()andstations_by_url(). A correctedurlalso replacesurl_resolved.station_click()still counts the click upstream, and returns the corrected stream URL.RadioBrowser(corrections=False)turns them off.The test suite validates every shipped file against a probatio schema, checks the folder and file names, and refuses a station corrected in two places.
schema.jsonis generated from the same schema, and a test keeps it in sync, so editors check a file while it is being written. Every other test runs without the shipped corrections, so adding one never breaks an unrelated test.The first correction is real: Radio Odyssey has two records with the same stream URL, one without tags or language. Its operator asked upstream for that one to be removed (radiobrowser-api-rust#267, no reply). Verified against the live API.
The README, CONTRIBUTING.md and AGENTS.md describe the corrections, and CONTRIBUTING.md how to add one.
Known limits, documented: a page of results is shorter than
limitwhen a station on it is deleted, the station counts of countries, languages and tags come from the API, andstations_by_url()does not find a station by its corrected URL.Type of change
Additional information
Checklist
poetry run pytestpasses locally. A pull request cannot be merged unless CI is green.poetry run prek run --all-filespasses (lint, format, and type checks).