Stop dropping seasons Plex reports without a parentRatingKey

The first real scan logged 15 "episode has no season; skipped" warnings. They
are Firefly S1 in TV Show Archive: Plex returns those episodes with
grandparentRatingKey and parentIndex set and parentGuid present, but
parentRatingKey null. Requiring parentRatingKey meant the entire season was
silently absent from the report - exactly the kind of quiet omission a reclaim
tool must not have.

The season key is now synthesized from show + season number when Plex omits it,
which is stable across scans. Keep marks are unaffected either way since they
key on GUIDs, not rating keys.

Also drops the multi_part flag from ordinary seasons. A season has one part per
episode, so part_count > 1 is normal there and the badge appeared on every TV
row; it now means what it says - a movie held more than once, or a season with
more files than episodes.

Both cases are in the fake server now, so the suite covers them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVbG48GAXfCZatcmX123Ra
This commit is contained in:
Jess Hallsworth 2026-09-10 14:37:30 +00:00
parent 71cfa31f09
commit d12cbc62ee
No known key found for this signature in database
5 changed files with 66 additions and 2 deletions

View file

@ -96,6 +96,25 @@ def _build(seed=7):
})
ep_rk += 1
# A show whose episodes carry no parentRatingKey — Plex really does this
# (Firefly, in the live TV Show Archive). The season must still be built.
orphan_show = "990"
shows.append({"sectionKey": "3", "ratingKey": orphan_show,
"guid": "plex://show/orphan", "type": "show", "title": "Orphan Show"})
for ep in range(1, 6):
episodes.append({
"sectionKey": "3", "ratingKey": str(ep_rk), "guid": "plex://episode/%d" % ep_rk,
"type": "episode", "title": "Orphan Ep %d" % ep, "index": ep,
"grandparentRatingKey": orphan_show, "grandparentTitle": "Orphan Show",
"parentRatingKey": None, "parentIndex": 1,
"addedAt": NOW - 900 * DAY, "duration": 45 * 60000, "viewCount": 0,
"Media": [{"videoResolution": "1080", "Part": [
{"id": 70000 + ep_rk,
"file": "/mnt/titan4/TVArchive/Orphan Show/S01/E%02d.mkv" % ep,
"size": 2 * 10**9}]}],
})
ep_rk += 1
# ── Tautulli history ───────────────────────────────────────────────
watchable = [m["ratingKey"] for m in movies] + [e["ratingKey"] for e in episodes]
row_id = 1