resources/lib/genres.py — unified genre map
Role
Three pure-data tables that map between the addon's unified genre
slugs and each provider's per-genre slugs. This is the single source of
truth that prevents every consumer from hard-coding its own
"films-on-itvx is films, films-on-stv is movies,
films-on-bbc is films" mapping. The genres are used by the
sync engine in library_sync.py to
iterate every per-provider genre slug when aggregating the catalogue for
sync.
UNIFIED_GENRES — 17 unified genres
A list of 17 tuples. Each tuple is (slug, label, providers) —
slug identifies the unified genre;
label is the human-readable name;
providers is the list of
(provider-name, that-provider's-own-genre-slug) pairs to
query when fetching the catalogue.
| Slug | Label | Providers |
|---|---|---|
films | Films | BBC, My5, ITVX, C4, STV |
drama | Drama & Soaps | BBC, My5 (×2: Drama+Soap), ITVX, C4, STV (×5: drama/crime/legal/thriller/comedy-drama), Blaze |
comedy | Comedy | BBC, ITVX, C4 |
documentaries | Documentaries | BBC, My5, ITVX, C4, STV (×4), Blaze |
sport | Sport | BBC, My5, ITVX |
news | News | BBC, ITVX, STV |
entertainment | Entertainment | BBC, My5, ITVX, C4, STV (×2), Blaze |
kids | Kids | My5 (milkshake!), ITVX (children) |
music | Music | BBC only |
food | Food | BBC, STV |
lifestyle | Lifestyle | BBC, STV |
history | History | BBC, STV, Blaze |
science | Science & Nature | BBC only |
arts | Arts | BBC only |
signed | Signed / BSL | BBC, ITVX |
true-crime | True Crime | STV (×2), Blaze |
scottish | Scottish | STV only |
STV's API exposes finely-sliced genres (crime-drama,
legal-drama, real-crime,
real-stories, …). To avoid bloating the UI with 15 nearly
identical tiles, multiple STV slugs are folded into the same unified genre.
The fetcher iterates the whole list and dedupes by show GUID.
Blaze's API doesn't expose genre filters at all — every unified genre
that nominally includes Blaze just hits blaze_vod.list_shows()
with no filter. That's why Blaze appears with empty strings in
drama, documentaries, entertainment,
history, true-crime.
SERIES_GENRES + MOVIE_GENRES
Two sets of unified-genre slugs used to decide whether a
given tile's shows are movies or series. MOVIE_GENRES = {"films"}
and SERIES_GENRES is everything else. Read by
library_sync.py (which filters
movie sync to the films slug only and iterates everything
except films for series).
PROVIDER_LABELS
The short codes shown as the [ITVX], [My5]
prefixes on tvshow titles and as the provider tag in listitem info.
Centralised because the prefix appears in titlesort comparisons in
library_sync.fix_sort_titles()
and any mismatch in capitalisation would break the sort.