Repository navigation
Return one station per stream in lists - #1633
Merged
Merged
Conversation
Many streams are listed more than once, added again by someone who could not edit the existing station: 8,669 streams across 13,173 extra records in the catalog. stations() and search() now return one station per stream, the one with the most votes, then the most clicks. Lookups by UUID and stations_by_url() still return every one of them, so a saved station keeps working. Pass deduplicate=False to get every station.
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
The API stays the same, but
stations()andsearch()can return fewer stations than before: duplicates of a stream are left out by default. Passdeduplicate=Falseto get every station, as before. Looking stations up by UUID andstations_by_url()are unchanged.Proposed change
Radio Browser has no way to edit a station, so people add a station again instead. The whole catalog (66,944 records) has 8,669 streams listed more than once, together 13,173 extra records. The worst one is a Quran stream, listed 234 times, in 226 countries. Browsing or searching shows every copy.
Deleting those as corrections (#1604) would take 9,057 entries with the rules we use there, and new duplicates keep coming. So this handles them in the library instead:
stations()andsearch()return one station per stream: the one with the most votes, then the most clicks, in the place where that stream first shows up, so the order of the results holds./or/;(an old Shoutcast trick) differs. The path and the query string are kept as they are.station(),stations_by_uuid()andstations_by_url()return every station, as before. A duplicate someone saved as a favorite, which Home Assistant stores by UUID, keeps working. That is the difference with deleting it.RadioBrowser(deduplicate=False)turns it off.The limit: only duplicates within one response are found. A page of results can be shorter than
limit, and two copies on different pages both show up. The README says so.Tests cover what counts as the same stream and what does not, which copy stays and where, the two list methods, turning it off, the lookups that keep every station, and a corrected URL that makes two stations the same. The README gets a section on duplicates, and AGENTS.md a gotcha.
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).