Disclaimer: This documentation is provided for convenience and may contain errors. Always verify information against the official Kodi and provider documentation. Report issues.
Fastmail
Home / Files / genres.py

resources/lib/genres.py — unified genre map

Path /resources/lib/genres.py Lines 25 Type static lookup tables ← imported by default.py (PROVIDER_LABELS), strm.py (UNIFIED_GENRES, PROVIDER_LABELS), library_sync.py

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

UNIFIED_GENRES = [(unified_id, label, [(provider, provider_slug), ...]), ...]

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.

SlugLabelProviders
filmsFilmsBBC, My5, ITVX, C4, STV
dramaDrama & SoapsBBC, My5 (×2: Drama+Soap), ITVX, C4, STV (×5: drama/crime/legal/thriller/comedy-drama), Blaze
comedyComedyBBC, ITVX, C4
documentariesDocumentariesBBC, My5, ITVX, C4, STV (×4), Blaze
sportSportBBC, My5, ITVX
newsNewsBBC, ITVX, STV
entertainmentEntertainmentBBC, My5, ITVX, C4, STV (×2), Blaze
kidsKidsMy5 (milkshake!), ITVX (children)
musicMusicBBC only
foodFoodBBC, STV
lifestyleLifestyleBBC, STV
historyHistoryBBC, STV, Blaze
scienceScience & NatureBBC only
artsArtsBBC only
signedSigned / BSLBBC, ITVX
true-crimeTrue CrimeSTV (×2), Blaze
scottishScottishSTV only
STV has lots of sub-genres

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 is empty-string

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

SERIES_GENRES · MOVIE_GENRES · lines 21, 23

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

PROVIDER_LABELS = {"bbc": "BBC", "my5": "My5", "itvx": "ITVX", "c4": "C4", "stv": "STV", "blaze": "BLAZE"} · line 25

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.