diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-08-29 18:45:37 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-08-29 18:45:37 +0200 |
| commit | 00880fd8b9d362ad391c784f1ee31bd62aa18d62 (patch) | |
| tree | 9e14bc8c1b6d8b18c9e2ec8fe1708f6ad3f18cb6 /packages/meshbay-node/tests/test_enrich.py | |
| parent | 8de80b7e19738b716d9973c0b4ba3b42085f7359 (diff) | |
| download | meshbay-00880fd8b9d362ad391c784f1ee31bd62aa18d62.tar.gz | |
fix(node): stop a movie with a mangled quality tag being shelved as a series
Found on demo35: "Some.Film.2017.MULTI.108.grp.mkv" — the release name's
"1080p" truncated to "108" — makes guessit read S01E08, so enrich.py's
flat-library branch (elif ep.episode is not None) filed a standalone film
as a series. "Fix match" then only offered TV results for the phantom
show, so there was no way out from the UI.
- title_parse.has_episode_marker(): true only for an explicit SxxExx /
1x08 / "Episode N" / "Season N" token, not a bare 3-4 digit run.
- enrich.py: the flat-library branch now needs ep.season AND ep.episode,
plus either a real marker or the absence of a "(2019)"-style year.
Every genuine flat-dumped episode in the corpus carries a marker, so
real shows are untouched; the same misparse on "1280" ("...2013.1280...")
is covered too.
docs/mediacenter.md §10.2. Known gap left open: no operator control over
the movie/show kind itself — a "this is a movie / a show" toggle would.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018BMLQjqFGCize2KtNBT79v
Diffstat (limited to 'packages/meshbay-node/tests/test_enrich.py')
| -rw-r--r-- | packages/meshbay-node/tests/test_enrich.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/test_enrich.py b/packages/meshbay-node/tests/test_enrich.py index 4b957cd..a35c713 100644 --- a/packages/meshbay-node/tests/test_enrich.py +++ b/packages/meshbay-node/tests/test_enrich.py @@ -373,3 +373,44 @@ async def test_enricher_reads_a_three_digit_episode_number_correctly(tmp_path, m assert fields["season"] == 6 assert fields["episode"] == 100 + + +@pytestmark_ffmpeg +@pytest.mark.asyncio +async def test_a_movie_with_a_mangled_quality_tag_is_not_shelved_as_a_series( + tmp_path, media_cache): + """ + Found live 2026-08-29: a standalone film whose "1080p" tag was + truncated to "108" in the filename makes guessit invent S01E08, so + enrich (flat library, no season ancestor) filed it as a nonexistent + series. A real flat-dumped episode carries an explicit SxxExx / 1x08 / + "Episode N" marker; a movie has a "(2017)"-style year and none. + """ + clip = tmp_path / "Some.Film.2017.MULTI.108.grp.mkv" + _make_clip(clip) + entry = IndexEntry(id="fid-trunc", name=clip.name, path=clip.name, + size=clip.stat().st_size, type="video", added_at=0) + + enricher = Enricher(media_cache) + _, fields = await _run(enricher, entry, clip) + + assert fields.get("season") is None and fields.get("episode") is None, ( + "a movie with a mangled quality tag must not become a series") + assert fields["display_title"] + + +@pytestmark_ffmpeg +@pytest.mark.asyncio +async def test_a_flat_episode_with_a_real_marker_stays_a_show_even_with_a_year( + tmp_path, media_cache): + """The guard must not misfire: a genuine flat-dumped episode that also + carries a year has an explicit SxxExx marker and stays a show.""" + clip = tmp_path / "Some.Show.2022.S01E02.1080p.WEB.mkv" + _make_clip(clip) + entry = IndexEntry(id="fid-marker", name=clip.name, path=clip.name, + size=clip.stat().st_size, type="video", added_at=0) + + enricher = Enricher(media_cache) + _, fields = await _run(enricher, entry, clip) + + assert fields["season"] == 1 and fields["episode"] == 2 |