Skip to content

Fix Plex watchlist retained series processing - #484

Open
zab1996 wants to merge 9 commits into
godver3:devfrom
zab1996:fix/plex-watchlist-series-retention
Open

Fix Plex watchlist retained series processing#484
zab1996 wants to merge 9 commits into
godver3:devfrom
zab1996:fix/plex-watchlist-series-retention

Conversation

@zab1996

@zab1996 zab1996 commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • reload the current content-source configuration before each scheduled or manual run so enabled versions do not become stale or empty
  • retain collected/partial TV series on Plex while continuing metadata expansion for missing episodes and new seasons
  • apply equivalent retained-series behavior to Plex RSS ingestion while preserving simulated removal for collected movies and ended series
  • keep removal failures conservative by continuing to process the affected Plex item
  • update watchlist summaries to report retained-and-processed series accurately
  • manual/debug-triggered content source runs now bypass the source cache, and the debug ingestion route now honors unblacklist_on_source_run, so re-running a source after enabling that setting actually reaches add_wanted_items instead of being cache-skipped
  • log source, unblacklist, granular, and bypass_cache state at the start of every content source run for diagnosis
  • make NZB season-pack sibling coalescing version-aware, closes NZB season-pack coalescing should be version-aware #485 — a 2160p episode could previously inherit an in-flight 1080p season-pack job because the sibling lookup ignored version
  • fix fallback-version creation being silently self-blocked: create_and_add_item_to_wanted_queue()'s ghostlist/blacklist guard matched on imdb_id/season/episode with no version filter, so it always found the original item's own just-set Blacklisted row and refused to create the fallback-version replacement — a no-op bug affecting every user with a fallback version configured since it was introduced in January
  • fix Task Manager toggles not persisting immediately: enable_task/disable_task only paused/resumed the in-memory scheduler job, never writing task_toggles.json, so a source a user "disabled" would silently re-enable itself on the next restart triggered by an unrelated settings save — the likely root cause behind widespread "I disabled it and it's still running" reports (e.g. Trakt sources still firing after being toggled off)

Tests

  • python3 -m unittest tests.test_plex_watchlist_retention tests.test_content_source_live_versions tests.test_manual_run_bypasses_cache tests.test_nzb_coalesce_version_match tests.test_fallback_version_ghostlist_check tests.test_task_toggle_persistence -v
  • python3 -m unittest discover -s tests -p "test_*.py" (250 tests; failures/errors match pre-existing baseline, none introduced by this branch)
  • python3 -m py_compile passed for all modified production and test modules

@zab1996
zab1996 marked this pull request as ready for review August 30, 2026 00:28
@aiknight-labs

Copy link
Copy Markdown

Thanks — PR #484 fixes the original early-continue issue, and reloading the current version configuration is a useful addition.\n\nOne database-level case may be worth testing before merge. The current diff allows the retained show to continue through normal metadata processing, but it does not carry any retained-series or missing-only context into metadata.py or wanted_items.py.\n\nWith granular versions enabled, consider this setup:\n1. A retained partial show has 1080p and 2160p enabled.\n2. An existing episode already has only its 1080p row.\n3. Another episode is genuinely absent.\n\nThe desired retained-series result, if this path is meant only to discover missing episodes and new seasons, would be zero new rows for the existing episode and the configured rows only for the absent episode. Under the existing wanted_items.py granular-version branch, the already-present episode may instead receive a new 2160p row.\n\nA local implementation avoided that by propagating a monitor_missing_episodes_only marker from both Plex ingestion paths through metadata expansion, then treating any existing episode key as satisfied for that background pass while still assigning all configured versions to genuinely absent episodes.\n\nCould you add a database-level regression test for that scenario? I can share the clean four-file reference patch if useful.

@zab1996
zab1996 marked this pull request as draft August 30, 2026 00:51
zab1996 and others added 3 commits August 29, 2026 21:13
… ingestion

Manual/debug re-runs of a content source were still cache-skipped before
reaching add_wanted_items, so flipping unblacklist_on_source_run and
re-running had no effect on already-blacklisted items. The separate
debug/manual ingestion route (get_and_add_wanted_content) also never read
or passed unblacklist_on_source_run at all. Also logs source/unblacklist/
granular state at the start of each content source run for diagnosis.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aiknight-labs

Copy link
Copy Markdown

I checked the latest PR head. It now covers the missing-only retained-series flow we discussed, including propagation through both Plex ingestion paths and metadata, the granular-version database guard, and regression coverage for existing versus genuinely missing episodes.

This matches the intended behavior of our local patch. Thanks for incorporating it!

zab1996 and others added 3 commits August 29, 2026 21:53
The in-flight sibling lookup matched only on imdb_id/season_number/state,
so an episode requesting version 2160p could inherit a season-pack job
another episode had already bound under version 1080p. Add a normalized
version equality check (stripping the '*' upgrade-pending marker) to the
sibling query so only same-version jobs are reused.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…klist

create_and_add_item_to_wanted_queue()'s ghostlist/blacklist guard matched
on imdb_id/season/episode only, with no version filter. The fallback-version
flow in blacklisted_queue.py always blacklists the original item (e.g.
'Preferred') for that same episode immediately before creating the
fallback (e.g. '480'), so the guard always found that just-created row and
refused to create the fallback -- logging "QueueManager reported failure in
creating/queuing fallback item". This made fallback versions a no-op for
every user who configured one. Scope the 'Blacklisted' half of the check to
the same normalized version being created; a genuine permanent ghostlist
still blocks at any version.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…Save

enable_task()/disable_task() only paused/resumed the in-memory scheduler
job and updated ProgramRunner.enabled_tasks -- neither wrote
task_toggles.json to disk. Persistence only happened via a separate 'Save'
button (save_task_toggles). Any later settings save restarts ProgramRunner,
which rebuilds enabled_tasks from the stale on-disk file, silently
re-enabling a source the user believed they'd disabled minutes earlier.

This is almost certainly the root cause behind widespread "I disabled
Trakt/a content source and it's still running" reports: flipping the
toggle looks like it worked (immediate UI update, immediate schedule
pause) but isn't durable across the frequent restarts that follow other
settings saves.

Factor the persistence logic into _persist_task_toggles_from_runner() and
call it from /enable_task and /disable_task, not just /save_task_toggles.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@zab1996
zab1996 marked this pull request as ready for review August 30, 2026 02:38
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