Skip to content

feat(tvdb): backfill the series tvdb id from TMDB - #370

Closed
sean-wils wants to merge 3 commits into
lostb1t:mainfrom
sean-wils:feat/series-tvdb-backfill
Closed

feat(tvdb): backfill the series tvdb id from TMDB#370
sean-wils wants to merge 3 commits into
lostb1t:mainfrom
sean-wils:feat/series-tvdb-backfill

Conversation

@sean-wils

Copy link
Copy Markdown
Contributor

Stacked on #363, last commit is the change.

#363's episode lookup can't start for a series with no tvdb id, which is 18% of the episodes it would serve. TMDB's series record carries the tvdb mapping, so fetch it once (cached like the other id lookups) and store it via widen_external_ids before asking TVDB.

TMDB's season listing has no `external_ids` per episode, and for a
long-running show it often has no episode record at all. TheTVDB answers
series plus season and episode number in one request, which is the only
id an episode is matched on by most providers.

Tried after TMDB comes back empty, and it no longer requires the series
to have a tmdb id: season and episode number plus the series' tvdb id is
enough, which 92.4% of the unresolved episodes in the library it was
measured on already have.

Dark unless a key is set. TheTVDB issues one per project with no bundled
fallback, so `tvdb_client` returns `None` and nothing changes for an
operator who has not opted in. The token it grants lasts a month and
there is no refresh endpoint, so it is cached and re-fetched by logging
in again.
`.ok()?` on a network call inside a function returning `Option` collapsed
three different outcomes into one silent `None`: no series tvdb id to ask
about, no client because the key is unset or the login failed, and the
request erroring. An operator seeing no ids filled had nothing to go on,
and neither did I.
TheTVDB cannot be asked about a series it has no id for, and 18% of the
episodes the coordinate lookup would serve sit under a series row
without one. TMDB's own series record carries the mapping, so it is
asked once, cached like any id lookup, and stored through
widen_external_ids. A failure only logs: the patch in hand still
stores, and the episode's missing ids mean the next delivery retries.
@lostb1t lostb1t closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants