Skip to content

fix: add TheMovieDb provider fallback for Jellyfin scanner#2605

Open
YakGravity wants to merge 3 commits intoseerr-team:developfrom
YakGravity:fix/jellyfin-themoviedb-provider-fallback
Open

fix: add TheMovieDb provider fallback for Jellyfin scanner#2605
YakGravity wants to merge 3 commits intoseerr-team:developfrom
YakGravity:fix/jellyfin-themoviedb-provider-fallback

Conversation

@YakGravity
Copy link

@YakGravity YakGravity commented Feb 28, 2026

Description

Shokofin (a Jellyfin plugin for anime managed by Shoko Server) writes TMDB IDs using the legacy Jellyfin provider key TheMovieDb instead of Tmdb. This causes Seerr to miss all anime managed by Shokofin during library sync, showing them as unavailable despite being present in Jellyfin.

This PR adds a fallback in three places in the Jellyfin scanner:

  1. Movie scanner (extractMovieIds): metadata.ProviderIds.Tmdb || metadata.ProviderIds.TheMovieDb || null
  2. TV show scanner (processJellyfinShow): Added || metadata.ProviderIds.TheMovieDb to the if-condition
  3. TV show scanner (processJellyfinShow): Number(metadata.ProviderIds.Tmdb || metadata.ProviderIds.TheMovieDb) for the tmdbId lookup

No breaking changes: When Tmdb exists (standard Sonarr/Radarr), || short-circuits and behavior is unchanged. The fallback only activates for items using the legacy TheMovieDb key.

How Has This Been Tested?

Tested on a live Jellyfin + Shokofin setup with multiple anime titles. Before the fix, all Shokofin-managed anime showed as unavailable in Seerr. After the fix, library sync correctly identifies them (e.g. "Frieren: Beyond Journey's End" returns mediaInfo.status: 4 PARTIALLY_AVAILABLE). Non-anime content (Sonarr/Radarr managed) continues to work without regression.

Screenshots / Logs (if applicable)

N/A

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

AI Disclosure

The root cause analysis (Shokofin using TheMovieDb vs Tmdb provider key) was identified through manual debugging with log analysis. Claude was consulted for reviewing the fix approach and drafting the PR description. The code changes were authored and tested manually.

Summary by CodeRabbit

  • Bug Fixes
    • Jellyfin integration now recognizes alternate TMDb identifier sources (both TMDb and TheMovieDb), improving show lookup and metadata matching.
    • More reliable TV show retrieval when metadata contains different TMDb provider keys, reducing missed or incorrect matchings during library scans.

Shokofin writes TMDB IDs using the legacy Jellyfin provider key
"TheMovieDb" instead of "Tmdb". This causes Seerr to miss all
anime managed by Shokofin during library sync, showing them as
unavailable despite being present in Jellyfin.

Adds nullish coalescing fallback (Tmdb ?? TheMovieDb) in three
places in the Jellyfin scanner for both movie and TV show
processing.
@YakGravity YakGravity requested a review from a team as a code owner February 28, 2026 17:06
@coderabbitai
Copy link

coderabbitai bot commented Feb 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03e45d4 and af73ce7.

📒 Files selected for processing (1)
  • server/lib/scanners/jellyfin/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/lib/scanners/jellyfin/index.ts

📝 Walkthrough

Walkthrough

Expanded Jellyfin scanner TMDb lookup to initialize tmdbId from metadata.ProviderIds.Tmdb with a fallback to metadata.ProviderIds.TheMovieDb, and apply the same fallback when passing the TMDb ID to the TV show lookup.

Changes

Cohort / File(s) Summary
Jellyfin Scanner TMDb ID Fallback
server/lib/scanners/jellyfin/index.ts
Initialize tmdbId from metadata.ProviderIds.Tmdb or fallback to metadata.ProviderIds.TheMovieDb; use the same fallback when passing the TMDb ID into the TV show lookup call.

Sequence Diagram(s)

(omitted — changes are a small lookup fallback and do not introduce multi-component control flow)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

bug, severity: critical

Suggested reviewers

  • gauthier-th
  • 0xSysR3ll

Poem

🐰 I hop through metadata, quick and spry,
I check both Tmdb and TheMovieDb nearby.
If one door's closed, the other I try,
IDs found, I give a cheerful cry!

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: add TheMovieDb provider fallback for Jellyfin scanner' directly and clearly describes the main change: adding support for the legacy TheMovieDb provider key as a fallback in the Jellyfin scanner, which is the core purpose of this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
server/lib/scanners/jellyfin/index.ts (1)

230-233: Consider using || instead of ?? for consistency with the condition.

Line 230 uses || (falsy check), while line 233 uses ?? (nullish check). If Tmdb were an empty string and TheMovieDb had a valid ID, the condition would pass but Number("") would yield 0.

This is likely an edge case since Jellyfin provider IDs are typically either present with values or absent, but using || on line 233 would match the condition's semantics.

Suggested change for consistency
       if (metadata.ProviderIds.Tmdb || metadata.ProviderIds.TheMovieDb) {
         try {
           tvShow = await this.getTvShow({
-            tmdbId: Number(metadata.ProviderIds.Tmdb ?? metadata.ProviderIds.TheMovieDb),
+            tmdbId: Number(metadata.ProviderIds.Tmdb || metadata.ProviderIds.TheMovieDb),
           });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/lib/scanners/jellyfin/index.ts` around lines 230 - 233, The condition
checks metadata.ProviderIds.Tmdb || metadata.ProviderIds.TheMovieDb but the call
to this.getTvShow uses the nullish coalescing operator
(metadata.ProviderIds.Tmdb ?? metadata.ProviderIds.TheMovieDb); change that to
use the logical OR (metadata.ProviderIds.Tmdb ||
metadata.ProviderIds.TheMovieDb) so the chosen value matches the condition
semantics before calling Number(...) in the getTvShow invocation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@server/lib/scanners/jellyfin/index.ts`:
- Around line 230-233: The condition checks metadata.ProviderIds.Tmdb ||
metadata.ProviderIds.TheMovieDb but the call to this.getTvShow uses the nullish
coalescing operator (metadata.ProviderIds.Tmdb ??
metadata.ProviderIds.TheMovieDb); change that to use the logical OR
(metadata.ProviderIds.Tmdb || metadata.ProviderIds.TheMovieDb) so the chosen
value matches the condition semantics before calling Number(...) in the
getTvShow invocation.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f74306e and d9e69cb.

📒 Files selected for processing (1)
  • server/lib/scanners/jellyfin/index.ts

@fallenbagel
Copy link
Collaborator

Please update your pr description with the proper pr template. You're missing several things from the checklist.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/lib/scanners/jellyfin/index.ts`:
- Line 63: The tmdbId assignment uses the nullish coalescing operator (??) which
differs from other checks (lines using ||) and will not fallback when
ProviderIds.Tmdb is an empty string; update the assignment for tmdbId to use the
logical OR operator so it falls back to metadata.ProviderIds.TheMovieDb for
falsy values (empty string, 0, undefined, null) before calling Number, i.e.,
replace the ?? between metadata.ProviderIds.Tmdb and
metadata.ProviderIds.TheMovieDb with || so the behavior is consistent with the
other checks.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d9e69cb and 03e45d4.

📒 Files selected for processing (1)
  • server/lib/scanners/jellyfin/index.ts

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