feat(tvdb): backfill the series tvdb id from TMDB - #370
Closed
sean-wils wants to merge 3 commits into
Closed
Conversation
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.
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.
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.