fix(import): treat cd1/cd2 folders as one audiobook

This commit is contained in:
Steppenstreuner
2026-08-28 19:21:24 +02:00
parent 24e3e9658e
commit b8f042025d
5 changed files with 153 additions and 18 deletions
+23
View File
@@ -47,3 +47,26 @@ def test_volume_number_must_match():
"media_type": "audiobook", "is_dir": False, "files": ["/d/f.mp3"]}]
out = best_matches(items, [r1, r123])
assert out[0]["suggested_request_id"] == 2
def test_leetspeak_title_matches():
assert normalize("DiE DR3i - Folge 03") == "die drei folge 03"
# digits at a word edge stay put, they carry the episode number
assert normalize("Folge03 v2 [m4b]") == "folge03"
r = req(1, "Die dr3i - Böses Erwachen", media_type="audiobook")
r.volume = 2
items = [{"path": "/d/x", "name": "Die drei 02 - Boeses Erwachen",
"media_type": "audiobook", "is_dir": True, "files": ["/d/x/a.mp3"]}]
out = best_matches(items, [r])
assert out[0]["suggested_request_id"] == 1
def test_digit_inside_word_is_not_a_volume():
from wordarr.importer.matcher import score
r = req(1, "Die dr3i - Folge 5", media_type="audiobook")
r.volume = 5
# "dr3i" must not contribute a "3" that satisfies the volume check
r3 = req(2, "Die dr3i - Folge 3", media_type="audiobook")
r3.volume = 3
assert score("DiE DR3i - 05 - Der Fall", r) > score("DiE DR3i - 05 - Der Fall", r3)