Skip to content

feat: auto-migrate series IMDb ID changes + verified Emby plugin 2.0.22 DLL - #129

Merged
sbcrumb merged 2 commits into
feature/v3from
fix/series-imdb-auto-migrate-and-emby-dll
Oct 1, 2026
Merged

sbcrumb merged 2 commits into
feature/v3from
fix/series-imdb-auto-migrate-and-emby-dll

Conversation

@sbcrumb

@sbcrumb sbcrumb commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Two independent pieces, bundled together since you're testing/merging them at the same time.

1. Auto-detect a series' IMDb ID changing between syncs

Sonarr can re-map a series' IMDb ID after the fact (common for very new/upcoming titles). series' PK is (imdb_id, instance), so a changed ID silently forked a show's episode history across two rows on the next sync — reproduced live ("Line of Fire (2026)": same path, two IMDb IDs, 2 episodes under one, 1 under the other).

upsert_series() now detects this automatically: same (instance, path) but a different imdb_id than before is treated as proof it's the same show, and merges the two the same way the existing manual migrate_series_imdb_id() does — episodes move to the new ID, any real season/episode collision is dropped rather than crashing on the primary key, stale series row removed. Self-heals existing duplicates (including the one that prompted this) on their next sync — no manual action needed.

Scoped to TV only; movies have the same underlying risk but a messier write-path shape, left as a deliberate follow-up.

2. Emby plugin DLL — now actually the fix that works

Emby-DLL/Chronarr.Emby.Plugin.dll in PR #128 was the first, incomplete v2.0.21 (GUID-format normalization only — didn't fix the reported symptom). Real root cause: config.js was reading the wrong VirtualFolderInfo field (Id, a legacy numeric string on some Emby versions — not ItemId, and not the actual Guid field that matches what Emby resolves at runtime). Fixed and confirmed live against a real server at v2.0.22 (excluded library → excluded=True, non-excluded → excluded=False). Full story in chronarr-plans/v3-plan.md Part 7 (local-only, not in this diff).

Testing

  • python -m py_compile core/database.py clean.
  • DLL SHA256 (de996550...) matches the build verified live against a real Emby server with real exclusion checks.
  • Auto-migrate logic not yet exercised against a running container — ready for you to test on feature/v3.

Sonarr can re-map a series' IMDb ID after the fact - common for very
new/upcoming titles whose metadata hasn't settled on a canonical ID
yet. series' PK is (imdb_id, instance), so a changed ID just created a
second row for the same show on the next sync, silently forking its
episode history across two entries (user-reported, reproduced: same
show, same path, two imdb_ids, 2 episodes under one and 1 under the
other).

upsert_series() now checks first whether a series already exists at
this (instance, path) under a different imdb_id - the path is the
stable signal here, it doesn't change just because a metadata ID got
corrected - and if so merges the two the same way the existing manual
migrate_series_imdb_id() does: episodes move to the new ID, any
season/episode that collides between the two old/new rows (a genuine
clash, not just happenstance) is dropped rather than crashing on the
primary key, and the stale series row is removed.

Self-heals existing duplicates on their next sync, no manual action
needed. Scoped to TV only for now - movies have the same underlying
risk (Radarr can remap an IMDb ID too) but two separate write paths
with different signatures, only one of which has a path to match on;
left as a deliberate follow-up rather than folding it in here.
The DLL merged in PR #128 was the first, incomplete v2.0.21 build
(GUID dash-format normalization only, SHA256 bf6bca18...) - real root
cause turned out to be config.js capturing the wrong VirtualFolderInfo
field (Id, a legacy numeric string on some Emby versions, not ItemId
or the actual Guid field). Fixed and confirmed live against a real
server (excluded library -> excluded=True, non-excluded ->
excluded=False) at v2.0.22, SHA256 de996550... - see
chronarr-plans/v3-plan.md Part 7 for the full story. Swapping in the
DLL that actually works.
@sbcrumb
sbcrumb merged commit bea0886 into feature/v3 Oct 1, 2026
1 check passed
@sbcrumb
sbcrumb deleted the fix/series-imdb-auto-migrate-and-emby-dll branch October 7, 2026 16:11
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.

1 participant