aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_title_parse.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-26 15:51:10 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-26 15:51:10 +0200
commitb1543faad87fd865f8746711ab5f10ac4f331e8b (patch)
tree37bca053cc875973c27dcdbbfed9bfb65f50c2f4 /packages/meshbay-node/tests/test_title_parse.py
parent84aa73e89cfe486c62317f761dcf87d7845eb4f7 (diff)
downloadmeshbay-b1543faad87fd865f8746711ab5f10ac4f331e8b.tar.gz
fix(video): group every episode under the show's own folder, not a per-file guessit title
The mechanism itself was wrong, not just the TMDB matching: a bare episode numbering convention with no show name in the filename at all (`001 Episode's Own Title.ext`, no SxxExx, no show prefix — entirely ordinary on its own) makes guessit invent a "title" from whatever text follows the number. That text is the individual episode's own name, and differs for every episode in the folder — trusting it, as the code did, groups nothing together at all: every episode became its own single- episode "show", searched against TMDB by that one-off title alone. Whenever a season-like ancestor folder exists (a numbered season, or Specials/Bonus/Extras -> season 0), its own root folder now names the show unconditionally — never a per-file guessit title, which cannot tell a show's real name from an individual episode's one-off name when the filename carries no reliable ShowName/SxxExx structure. The walk continues past *every* consecutive season-like ancestor, not just the first: a per-season Bonus folder (Show/Season N/Bonus/file.ext) is nested two levels inside the show, both "Bonus" and "Season N" season-like on their own, and stopping at the first would hand back "Season N" as the show's name instead of "Show". Also adds "livre" ("book") to the season-word vocabulary (§3.4) — some shows number their seasons that way (Roman numerals) rather than "season"/"saison". Supersedes _title_from_show_siblings from the previous commit (removed): that fallback assumed a per-file title could still be trusted often enough to be worth borrowing from a sibling season folder — this fix means it never needs trusting in the first place once a season-like ancestor exists. Verified directly against the real library this was found on, not just synthetic tests: every sample file (a numbered episode, a Book/Bonus feature, a Book-root "making of") now resolves to the show's real name.
Diffstat (limited to 'packages/meshbay-node/tests/test_title_parse.py')
-rw-r--r--packages/meshbay-node/tests/test_title_parse.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/test_title_parse.py b/packages/meshbay-node/tests/test_title_parse.py
index 1a277f2..1881613 100644
--- a/packages/meshbay-node/tests/test_title_parse.py
+++ b/packages/meshbay-node/tests/test_title_parse.py
@@ -111,6 +111,13 @@ def test_season_folder_roman_numeral():
assert season_from_folder_name("Saison IV") == 4
+def test_season_folder_book_word_roman_numeral():
+ # Some shows number their seasons by "book" (Roman numerals) rather
+ # than "season"/"saison" — real, observed vocabulary (§3.4).
+ assert season_from_folder_name("Livre I") == 1
+ assert season_from_folder_name("Livre VI") == 6
+
+
def test_specials_folder_maps_to_season_zero():
assert season_from_folder_name("Specials") == 0
assert season_from_folder_name("Bonus") == 0