Files
LeoVasanko ff6b195973 Fix rescan loop: short-circuited registration dropped files from state
The directory worker registered video files with
'node["changed"] = node["changed"] or await _register_candidate(...)',
so once one file in a directory was found changed, the rest were never
registered: they fell out of known_paths, were pruned from the persisted
seen-mtimes at finalize, and were rediscovered as new on every scan.
That rotating ~10-item subset was reprocessed (metadata, TMDb lookups,
logs) every 30 seconds forever.

Also fix the self-sustaining reprocess loop for items that produce no
index entries (no playable file, no parseable episodes, non-media):
they never appear in the index, so the DB-aware mtime gating alone could
never skip them.  They are now recorded in a persisted empty_mtimes map
(scan-state.json) and skipped while their mtime is unchanged.

Episode/playable/blu-ray finder caches are now cleared at the start of
each scan: an empty result cached before a download finished (or during
a transient network-mount error) previously stuck for the process
lifetime and reported "no episodes found" for series that have episodes.

Logging: a no-change scan now emits a single line with item count and
duration; per-item "up to date" chatter moved to debug; change scans
report the new/changed count plus per-item reason lines (stored vs
current mtime, index/empty-marker membership), finalize prune/commit
traces, and scan-state load/save confirmations.

Add AGENTS.md noting the project's Python 3.14 baseline (PEP 758
unparenthesized except) so tooling does not flag it as a syntax error.
2026-09-09 14:40:32 +00:00

889 B

MediaHive agent notes

Python 3.14 syntax: unparenthesized except is valid

This project targets Python >= 3.14 (see requires-python in pyproject.toml). Per PEP 758 (Final, Python 3.14), multiple exception types may be caught without parentheses:

except OSError, ValueError:   # valid Python 3.14+, equivalent to except (OSError, ValueError):

Parentheses are still required when an as clause is used: except (OSError, ValueError) as e:.

Do not "fix" these into tuple form, and do not flag them as Python 2 remnant syntax errors — that rule is obsolete training data. Any syntax validation, compilation check, or linting of this codebase must run under Python 3.14+ (e.g. python -m py_compile with a 3.14 interpreter); older interpreters will report false SyntaxErrors on this and other 3.14-only constructs.