fix(plex): S5a review round 2 — dup-HU guard + tests for dup-guid & guid-keep
- Correctness: _sync_overlay now first-wins on a guid (a `seen` set) so a duplicate HU entry sharing a guid can't overwrite the applied Hungarian metadata or double-count `overlaid`. - Test-coverage: cover the earlier dup-guid fix (both editions of a shared-guid pair get *_hu, counted once) and the guid-keep guard (_apply_item preserves a prior guid when the listing carries none, still updates on a real one). Full backend suite 276 passed / 2 skipped.
This commit is contained in:
@@ -463,11 +463,13 @@ def _sync_overlay(
|
||||
for group in by_guid.values():
|
||||
for row in group:
|
||||
row.title_hu = row.summary_hu = row.genres_hu = None
|
||||
seen: set[str] = set() # first HU entry for a guid wins; a dup HU item can't overwrite or double-count
|
||||
for meta in _paginate(plex, lib.plex_key, item_type):
|
||||
g = _canonical_guid(meta)
|
||||
targets = by_guid.get(g) if g else None
|
||||
if not targets:
|
||||
if not targets or g in seen:
|
||||
continue
|
||||
seen.add(g)
|
||||
title_hu = (meta.get("title") or "").strip() or None
|
||||
summary_hu = meta.get("summary")
|
||||
genres_hu = _tags(meta, "Genre")
|
||||
|
||||
Reference in New Issue
Block a user