summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_title_parse.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-29 18:45:37 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-29 18:45:37 +0200
commit00880fd8b9d362ad391c784f1ee31bd62aa18d62 (patch)
tree9e14bc8c1b6d8b18c9e2ec8fe1708f6ad3f18cb6 /packages/meshbay-node/tests/test_title_parse.py
parent8de80b7e19738b716d9973c0b4ba3b42085f7359 (diff)
downloadmeshbay-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_title_parse.py')
-rw-r--r--packages/meshbay-node/tests/test_title_parse.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/test_title_parse.py b/packages/meshbay-node/tests/test_title_parse.py
index ac4d434..045635f 100644
--- a/packages/meshbay-node/tests/test_title_parse.py
+++ b/packages/meshbay-node/tests/test_title_parse.py
@@ -7,6 +7,7 @@ is a manual acceptance step (§11), not something this repo's corpus holds.
from meshbay_node.indexer.title_parse import (
ParsedName,
clean_query,
+ has_episode_marker,
leading_episode_number,
naive_title,
parse_episode_filename,
@@ -113,6 +114,27 @@ def test_clean_query_despaces_a_folder_name_without_eating_the_last_word():
assert naive_title("Some.Show.Name") != "Some Show Name" # the trap it avoids
+# ── §10.1/V14: telling a real episode marker from a mangled number ──────────
+
+def test_has_episode_marker_accepts_real_markers():
+ for name in ["Some.Show.S01E08.mkv", "some.show.s1.e8.mkv",
+ "Some Show 1x08.mkv", "Some Show 01x08.mkv",
+ "Some Show Episode 8.mkv", "Some Show ep08.mkv",
+ "Some Show ep.8.mkv", "Some Show Season 1.mkv",
+ "Une Serie Saison 3.mkv"]:
+ assert has_episode_marker(name), name
+
+
+def test_has_episode_marker_rejects_bare_numbers_and_ordinary_words():
+ # "1080p" truncated to "108", "1280" left in, a year, plain words that
+ # merely contain "ep" — none of these are episode markers.
+ for name in ["Some.Film.2017.MULTI.108.grp.mkv",
+ "Some.Flick.2013.1280.x264-grp.mkv",
+ "Some Movie 2017.mkv", "The Dark Knight.mkv",
+ "Sleep 8.mkv", "Deep 8 mm.mkv", "Ocean's 11.mkv"]:
+ assert not has_episode_marker(name), name
+
+
# ── bug 2026-08-29: guessit peels "Volume N" off the title ─────────────────
def test_movie_volume_number_is_folded_back_into_the_title():