Repository navigation
feat: auto-migrate series IMDb ID changes + verified Emby plugin 2.0.22 DLL - #129
Merged
Merged
Conversation
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.
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.
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 differentimdb_idthan before is treated as proof it's the same show, and merges the two the same way the existing manualmigrate_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.dllin PR #128 was the first, incomplete v2.0.21 (GUID-format normalization only — didn't fix the reported symptom). Real root cause:config.jswas reading the wrongVirtualFolderInfofield (Id, a legacy numeric string on some Emby versions — notItemId, and not the actualGuidfield 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 inchronarr-plans/v3-plan.mdPart 7 (local-only, not in this diff).Testing
python -m py_compile core/database.pyclean.de996550...) matches the build verified live against a real Emby server with real exclusion checks.feature/v3.