feat(rules): metadata fallback when series absent from Sonarr#3002
Merged
Conversation
c56e8d5 to
32d5bc3
Compare
Items can exist in the media server but be absent from Sonarr (deleted, never added, or movies mis-classified as shows by Jellyfin/Emby). For show-level properties whose semantics are intrinsic to the show rather than to Sonarr's local state, the Sonarr getter now falls back to the configured metadata provider after a confirmed Sonarr miss. - Fallback set: `ended`, `firstAirDate` (show-level), `seasons` (show-level, specials-filtered to match Sonarr's `statistics.seasonCount`). - Excluded by design: `status`, `originalLanguage`, `rating` — provider vocabularies / scales don't compare to Sonarr's. Sonarr-only state (`monitored`, `tags`, `filePath`, `diskSize*`, …) also stays null. - TVDB extended series interface gains `seasons[]` typing so the count can be filtered to the default ordering before excluding Season 0. - "Not in Sonarr/Radarr" warns now end with "Is the series/movie tracked in Sonarr/Radarr?" to prompt the user. Sonarr is always primary; fallback only fires on the empty `getSeriesByTvdbId` return, and the existing ArrLookupCache still dedupes the miss per run.
32d5bc3 to
b88159a
Compare
Collaborator
Author
|
/release-pr |
Contributor
|
Released to |
Collaborator
Author
|
Tested and works in prod! |
maintainerr-automation Bot
added a commit
that referenced
this pull request
May 28, 2026
…#3003) Items can exist in the media server but be absent from Sonarr (deleted, never added, or movies mis-classified as shows by Jellyfin/Emby). For show-level properties whose semantics are intrinsic to the show rather than to Sonarr's local state, the Sonarr getter now falls back to the configured metadata provider after a confirmed Sonarr miss. - Fallback set: `ended`, `firstAirDate` (show-level), `seasons` (show-level, specials-filtered to match Sonarr's `statistics.seasonCount`). - Excluded by design: `status`, `originalLanguage`, `rating` — provider vocabularies / scales don't compare to Sonarr's. Sonarr-only state (`monitored`, `tags`, `filePath`, `diskSize*`, …) also stays null. - TVDB extended series interface gains `seasons[]` typing so the count can be filtered to the default ordering before excluding Season 0. - "Not in Sonarr/Radarr" warns now end with "Is the series/movie tracked in Sonarr/Radarr?" to prompt the user. Sonarr is always primary; fallback only fires on the empty `getSeriesByTvdbId` return, and the existing ArrLookupCache still dedupes the miss per run. Co-authored-by: enoch85 <mailto@danielhansson.nu>
Contributor
|
🎉 This PR is included in version 3.13.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
If a show is in your media server but not in Sonarr (you deleted it, never added it, or your library has a movie that Jellyfin/Emby tagged as a series and gave TV-show IDs), rules touching show-level properties get silently skipped right now — Sonarr has no record to read. This PR adds a small fallback: when Sonarr returns nothing, we ask whichever metadata provider you've already got configured (TMDB or TVDB).
Only a few properties get the fallback — the ones that genuinely mean the same thing across Sonarr, TMDB, and TVDB:
ended(true/false)firstAirDateat show levelseasonsat show level — counts real seasons, no specials, matching what Sonarr'sseasonCountdoesI deliberately skipped a few that look similar but actually differ between sources:
status— Sonarr uses a lowercase enum (continuing/ended/…); TMDB returns free-form strings likeReturning Series; TVDB returnsContinuing/Ended/…originalLanguage— Sonarr givesEnglish, TMDB givesen, TVDB givesengrating— different scales and aggregations on each sideLetting any of those through would mean rules silently mis-evaluate when the fallback kicks in. Anything that's only in Sonarr's local state (
monitored,tags,filePath, disk-size stuff, the file-derived properties, …) keeps returning null like before — providers can't supply that.A few mechanical bits worth flagging:
ArrLookupCachestill dedupes that miss across the run.seasons[]and the count filters to the series' default ordering before dropping Season 0. Otherwise the raw length over-counts wildly.Tests cover the status mapping in both providers, the specials filter, and the fallback path through
SonarrGetterService. Full suite passes (1513 tests); format / lint / build all clean.