feat: Add movie database identifier extraction and update related tests

This commit is contained in:
sha
2025-12-26 14:34:58 +00:00
parent 38e3f0e553
commit c5ab985440
6 changed files with 84 additions and 2 deletions
+6
View File
@@ -255,3 +255,9 @@ The Holdovers (2023) [1080p,ukr,eng].mkv
Killers of the Flower Moon (2023) [2160p,HDR,ukr,eng].mkv
Poor Things (2023) [1080p,ukr,eng].mkv
Anatomy of a Fall (2023) [720p,ukr,eng].mkv
Star Wars: Episode IV - A New Hope (1977) [1080p,ukr,eng].mkv
Грицькові книжки.(1979).[ukr].{imdb-tt9007536}.mpg
Гуси-Лебеді.(1949).[ukr,2rus].{imdb-tt1070792}.mkv
Apple 1984 (1984) [Remastered] [2160p,eng] [imdbid-tt4227346].mkv
Harley Quinn. A Very Problematic Valentine's Day Special (2023) WEB-DL [1080p,ukr,eng] [imdbid-tt22525032].mkv
+18 -1
View File
@@ -79,4 +79,21 @@ def test_extract_hdr(filename):
print(f"\nFilename: \033[1;36m{filename}\033[0m")
print(f"Extracted HDR: \033[1;32m{hdr}\033[0m")
# HDR should be 'HDR' or None
assert hdr is None or hdr == 'HDR'
assert hdr is None or hdr == 'HDR'
@pytest.mark.parametrize("filename", load_test_filenames())
def test_extract_movie_db(filename):
"""Test movie database identifier extraction from filename"""
file_path = Path(filename)
extractor = FilenameExtractor(file_path)
movie_db = extractor.extract_movie_db()
# Print filename and extracted movie DB clearly
print(f"\nFilename: \033[1;36m{filename}\033[0m")
print(f"Extracted movie DB: \033[1;32m{movie_db}\033[0m")
# Movie DB should be tuple (str, str) or None
if movie_db:
assert isinstance(movie_db, tuple) and len(movie_db) == 2
assert isinstance(movie_db[0], str) and isinstance(movie_db[1], str)
else:
assert movie_db is None