Skip to content

feat(rules): metadata fallback when series absent from Sonarr#3002

Merged
enoch85 merged 1 commit into
developmentfrom
feat/sonarr-metadata-fallback
May 28, 2026
Merged

feat(rules): metadata fallback when series absent from Sonarr#3002
enoch85 merged 1 commit into
developmentfrom
feat/sonarr-metadata-fallback

Conversation

@enoch85

@enoch85 enoch85 commented May 28, 2026

Copy link
Copy Markdown
Collaborator

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)
  • firstAirDate at show level
  • seasons at show level — counts real seasons, no specials, matching what Sonarr's seasonCount does

I 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 like Returning Series; TVDB returns Continuing/Ended/…
  • originalLanguage — Sonarr gives English, TMDB gives en, TVDB gives eng
  • rating — different scales and aggregations on each side

Letting 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:

  • Sonarr is still hit first; the fallback only runs after a confirmed miss, and the existing ArrLookupCache still dedupes that miss across the run.
  • TVDB's extended series response returns season entries for every alternative ordering (Aired / DVD / Absolute / Alternate / Regional), so I added typing for seasons[] and the count filters to the series' default ordering before dropping Season 0. Otherwise the raw length over-counts wildly.
  • The existing "not in Sonarr/Radarr" warnings now end with "Is the series/movie tracked in Sonarr/Radarr?" so users have a clear next step instead of a cryptic ID dump.

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.

@enoch85 enoch85 force-pushed the feat/sonarr-metadata-fallback branch 2 times, most recently from c56e8d5 to 32d5bc3 Compare May 28, 2026 11:05
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.
@enoch85 enoch85 force-pushed the feat/sonarr-metadata-fallback branch from 32d5bc3 to b88159a Compare May 28, 2026 11:42
@enoch85

enoch85 commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

/release-pr

@github-actions

Copy link
Copy Markdown
Contributor

Released to maintainerr/maintainerr:pr-3002 🚀

@enoch85

enoch85 commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

Tested and works in prod!

@enoch85 enoch85 merged commit bcf68ec into development May 28, 2026
14 checks passed
@enoch85 enoch85 deleted the feat/sonarr-metadata-fallback branch May 28, 2026 12:02
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>
@maintainerr-automation

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.13.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant