Repository navigation
Look up several stations by UUID, or by stream URL - #1580
Merged
Merged
Conversation
Add stations_by_uuid() to get several stations in one request, and stations_by_url() to find the stations behind a stream URL. Parse lists of stations in one helper.
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. Two new methods.
Proposed change
Two lookups the API documents but the library did not offer:
stations_by_uuid(uuids=[...])gets several stations in a single request, throughstations/byuuid?uuids=.... Refreshing a list of 30 favorite stations used to take 30 requests throughstation(). UUIDs of stations that no longer exist are simply left out of the result. An empty list returns[]without a request.stations_by_url(url=...)gets the stations behind a stream URL, throughstations/byurl. Several stations can share a stream, so it returns a list.Parsing a list of stations now lives in one
stations_from_json()helper, instead of the same block insearch(),stations()and now these two.Checked against the live API: two known UUIDs plus one unknown return the two known stations, and the stream URL of Classic Vinyl HD returns the eleven stations that use it. Both are in the README.
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).