aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-26 15:36:23 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-26 15:36:23 +0200
commit84aa73e89cfe486c62317f761dcf87d7845eb4f7 (patch)
tree35b655fa27340ca6295f00daaa72a014c8f58c56 /packages/meshbay-node/src
parent4c45792c861c47d44ebdbbab4130e37fba5d6795 (diff)
downloadmeshbay-84aa73e89cfe486c62317f761dcf87d7845eb4f7.tar.gz
fix(video): TMDB match cache never invalidated on movie<->show reclassification
The real reason a node restart alone didn't fix already-indexed entries after the previous commit's enrichment change: _do_media_meta_request checked media_cache's file->tmdb mapping (keyed by content hash) and trusted it unconditionally, before ever comparing it against the file's *current* movie/show classification. A file whose season/episode changed on a later scan — exactly what the Specials-folder fix does, for every file it reclassifies from "movie" to "tv" — kept answering with its stale, wrong-kind-of-match forever, since nothing about a reclassification touches this cache or its key. Now falls through to a fresh search whenever the cached media_type disagrees with what the entry resolves to right now, rather than trusting a mapping that predates the file's current classification.
Diffstat (limited to 'packages/meshbay-node/src')
-rw-r--r--packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py b/packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py
index 724527b..2b3e3ee 100644
--- a/packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py
+++ b/packages/meshbay-node/src/meshbay_node/transport/webrtc_server.py
@@ -2914,8 +2914,20 @@ class WebRTCPeerSession:
meta = None
tmdb_id = None
if cached is not None:
- tmdb_id, media_type = cached
- meta = await media_cache.get_tmdb_meta(tmdb_id, media_type)
+ cached_tmdb_id, cached_media_type = cached
+ # Trustworthy only if it still agrees with what this file
+ # resolves to *now*. season/episode come from index-time
+ # enrichment (enrich.py), which can reclassify a file between
+ # movie and show on a later scan without this cache knowing —
+ # it is keyed by the file's content hash alone, which a
+ # reclassification never changes. Found live: an enrichment fix
+ # to a Specials-folder bug reclassified hundreds of files from
+ # "movie" to "tv", and every one kept answering with its
+ # stale movie-era match forever, because this was trusted
+ # before ever comparing media_type against the current one.
+ if cached_media_type == media_type:
+ tmdb_id = cached_tmdb_id
+ meta = await media_cache.get_tmdb_meta(tmdb_id, media_type)
if meta is None:
result, ratio = await self._tmdb_search(tmdb_client, entry, is_show)