Skip to content

List codecs and states - #1583

Merged
frenck merged 1 commit into
mainfrom
frenck/codecs-and-states
Oct 1, 2026
Merged

frenck merged 1 commit into
mainfrom
frenck/codecs-and-states

Conversation

@frenck

@frenck frenck commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Breaking change

None. Two new methods and two new models.

Proposed change

Two more lists the API documents, next to countries, languages and tags:

  • codecs() lists the codecs stations stream in, with their station count, as Codec objects.
  • states() lists the states, provinces and regions stations are in, as State objects. It takes a country to only get the states of one country.

Both take the same arguments as the other lists, including the name filter from #1581, and refuse the orders the API cannot sort them by. Checked against the live API: codecs?order=votes answers with a server error like the other lists.

Two things about states() that are now in the docstring and the README:

  • The country filter takes the full name the API stores, like "The Netherlands" or "Germany". It is case sensitive (germany finds nothing), and it is not a country code.
  • States are entered by hand along with the stations, so the data is messy: expect anything from a province to a full street address.

A country without a name filter needs a trailing slash in the path (states/The%20Netherlands/), otherwise the API takes the country for a name filter. The tests cover all four combinations, and escaping.

Live: codecs(name="aac") returns AAC, AAC+, and the AAC video combinations; states(country="The Netherlands") returns 154 states.

Type of change

  • Dependency or tooling upgrade
  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Deprecation (replaces or removes a feature, with a migration path)
  • Breaking change (a fix or feature that changes existing behavior)
  • Code quality, refactor, or test-only change
  • Documentation only

Additional information

Checklist

  • I fully understand the code in this pull request and can explain every line, including any AI-assisted changes.
  • The change is covered by tests, and poetry run pytest passes locally. A pull request cannot be merged unless CI is green.
  • poetry run prek run --all-files passes (lint, format, and type checks).
  • No commented-out or dead code is left in the pull request.

Add codecs() and states(), with Codec and State models, next to the
country, language and tag lists. states() takes the full country name the
API stores to only list the states of one country.
@frenck frenck added the new-feature New features or options. label Oct 1, 2026
@frenck
frenck merged commit 51cc1ef into main Oct 1, 2026
31 checks passed
@frenck
frenck deleted the frenck/codecs-and-states branch October 1, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature New features or options.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant