diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-08-29 15:12:32 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-08-29 15:12:32 +0200 |
| commit | 5a88f8d7a0a35b0c75b0a56d0f6fce1d0a495c12 (patch) | |
| tree | cbc0a8207885476cd0d331db399536c259ca4f80 /packages/meshbay-node/src/meshbay_node/ops.py | |
| parent | be57cf9c3b499c8e59a94d13059f16f1456fcae1 (diff) | |
| parent | 71b7a310ce938f072fe20f27eeeadd40685f1ad1 (diff) | |
| download | meshbay-5a88f8d7a0a35b0c75b0a56d0f6fce1d0a495c12.tar.gz | |
Merge branch 'fix/videos-tmdb-matching'
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/ops.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/ops.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ops.py b/packages/meshbay-node/src/meshbay_node/ops.py index cb8e01e..c921b05 100644 --- a/packages/meshbay-node/src/meshbay_node/ops.py +++ b/packages/meshbay-node/src/meshbay_node/ops.py @@ -974,6 +974,31 @@ async def prune_index_cache(state: dict) -> dict: return {"status": "pruned", "removed": len(stale), "kept": len(paths) - len(stale)} +# ── Videos: force TMDB re-matching ─────────────────────────────────────────── +# +# `media_cache.file_tmdb` is keyed by a file's content hash and is otherwise +# only pruned on deletion, so a fixed matcher/parser never dislodges a match +# already in cache. This drops a group's *auto-resolved* mappings so the +# next `media_meta_req` for each poster tile re-resolves against the current +# code. Re-resolution is lazy and calls TMDB once per unique title — real +# API budget — so this is an explicit operator action, never a background job. +# Manual "Fix match" corrections (media_cache.tmdb_override) are kept. + +async def rematch_video(state: dict, group_id: str) -> dict: + media_cache = state.get("media_cache") + if media_cache is None: + raise OpError("No media cache in this process", status=503) + indexer = (state.get("indexers") or {}).get(group_id) + if indexer is None: + raise OpError("Unknown group", status=404) + file_ids = [e.id for e in indexer.index.entries if e.type == "video"] + removed = await media_cache.clear_tmdb_matches(file_ids) + log.info("Video rematch for group %s: %d auto match(es) cleared across %d video file(s)", + group_id[:8], removed, len(file_ids)) + return {"status": "cleared", "removed": removed, "videos": len(file_ids), + "group_id": group_id} + + # ── Reload ────────────────────────────────────────────────────────────────── async def reload_config(state: dict) -> dict: |