Repository navigation
Search tags and languages regardless of case - #1590
Merged
Merged
Conversation
The API stores tags and languages in lowercase and matches them case sensitive, so "Jazz" or "Dutch" found nothing, including the language names languages() itself returns. Lowercase those filter values.
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. Searches for a tag or language with uppercase letters used to find nothing, and now find what they should.
Proposed change
Found while comparing with other Radio Browser clients: pyradios had to fix the same thing (andreztz/pyradios#31). The API stores tags and languages in lowercase and matches them case sensitive. Checked against the live API:
This bites in combination with the library itself:
languages()returns title-cased names like "Dutch", so passing aLanguage.nameback intosearch(language=...)orstations(filter_by=FilterBy.LANGUAGE_EXACT, ...)found nothing.Tag and language values are now lowercased before they are sent:
tag,tag_listandlanguageinsearch(), and the term of the tag and languageFilterByvalues instations()andsearch(). Other filters, like name, state and codec, are already case insensitive in the API and are sent as given.The docstrings and README also explain what "exact" means for tags and languages, which tripped up a radiobrowser4j user (sfuhrm/radiobrowser4j#125): an exact match is about the tag or language itself, so a station with other tags or languages next to it still matches.
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).