diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-08-26 17:18:37 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-08-26 17:18:37 +0200 |
| commit | 80cb6c4dc5f22336387f2ac74ef2cb85cf2cf7d4 (patch) | |
| tree | 590e2daf81b2feef674f1bd580b9bf40f83addad /packages/meshbay-node/tests/test_media_meta_request.py | |
| parent | ca62b4123b854fc9ece258e14c84c895aaa275cd (diff) | |
| parent | 59289b82dc8af08c605fd247c90a5c5ec92c6db3 (diff) | |
| download | meshbay-80cb6c4dc5f22336387f2ac74ef2cb85cf2cf7d4.tar.gz | |
Merge branch 'feat/video-type-filter'
Videos app grouping and TMDB matching fixes, plus a new toolbar filter:
- A season-like ancestor folder (numbered season, or Specials/Bonus/Extras
-> season 0) now names the show from its own root folder, unconditionally
— never a per-file guessit title, which cannot tell a show's real name
from an individual episode's own one-off name when the filename carries
no reliable ShowName/SxxExx structure. Fixes a real show's episodes and
Specials folder alike showing up as dozens of individual "movies", each
matched against TMDB by its own one-off title.
- The ancestor walk continues past every consecutive season-like folder,
not just the first — a per-season Bonus folder is nested two levels
inside the show, and stopping at the first would name the season as the
show.
- A season spanning more than one folder (a per-book Bonus folder nested
inside every numbered season) no longer hands out colliding episode
numbers independently in each one.
- guessit's own episode number is not trusted when it comes from a bare
3-digit leading number ("100" parses as season=1/episode=0, not
episode=100) — read directly via regex instead.
- Recognizes "S1"/"S2"-style abbreviated season folders, not just full
words ("Season"/"Saison"/"Livre") — a real show organized its later
seasons this way and they never got the ancestor-based grouping fix at
all.
- The TMDB match cache is no longer trusted across a movie<->show
reclassification it doesn't know happened.
- New: an All/Movies/Series filter in the Videos toolbar, to the left of
the search field, defaulting to "All"; wraps correctly on mobile.
Verified live against the real libraries these were found on throughout —
not synthetic reproduction alone. 430 hub tests + 667 node tests passing.
Diffstat (limited to 'packages/meshbay-node/tests/test_media_meta_request.py')
| -rw-r--r-- | packages/meshbay-node/tests/test_media_meta_request.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/test_media_meta_request.py b/packages/meshbay-node/tests/test_media_meta_request.py index a7355e8..a752825 100644 --- a/packages/meshbay-node/tests/test_media_meta_request.py +++ b/packages/meshbay-node/tests/test_media_meta_request.py @@ -112,6 +112,43 @@ async def test_two_episodes_in_the_same_season_folder_each_get_their_own_metadat "two different shows sharing a season folder must not resolve to the same match") +async def test_a_reclassified_file_ignores_its_stale_cached_match(media_cache): + """ + A file's classification (movie vs show) comes from its IndexEntry's + season/episode — set by index-time enrichment, which can change its + mind on a later scan (a filename-parsing fix reclassifying a whole + folder from "movie" to "tv", say) without media_cache's file->tmdb + mapping knowing anything happened: that cache is keyed by the file's + content hash alone, unchanged by any such reclassification. Found + live: exactly this scenario left every affected file answering with + its stale, wrong-kind-of-match forever, since the cache was trusted + before ever comparing media_type against what the entry resolves to + now. + """ + index = GroupIndex(group_id="g" * 32, sk_node=Ed25519PrivateKey.generate()) + entry = IndexEntry(id="id-1", name="ep.mkv", path="shows/Show/Specials", + size=1, type="video", added_at=0, + display_title="Some Show", season=0, episode=1) + index.add_entry(entry) + # Pre-populate the cache exactly as it would be left over from before + # entry.season/episode existed — a movie search matched to some + # unrelated title, cached by this file's content hash. + await media_cache.set_file_tmdb("id-1", "stale-movie-id", "movie") + await media_cache.set_tmdb_meta("stale-movie-id", "movie", { + "title": "An Unrelated Movie", "original_title": "An Unrelated Movie", + "release_date": "1999-01-01", "confidence": 1.0, + }) + client = FakeTmdbClient() + session = _session(index, media_cache, client) + + await session._do_media_meta_request({"file_id": "id-1"}) + + resp = session.sent[0] + assert resp["title"] == "Some Show" + assert ("tv", "Some Show") in client.searched + assert resp["tmdb_id"] != "stale-movie-id" + + async def test_missing_file_id_is_refused(media_cache): index = GroupIndex(group_id="g" * 32, sk_node=Ed25519PrivateKey.generate()) session = _session(index, media_cache, FakeTmdbClient()) |