feat: Enhance metadata extraction and formatting, improve extractor architecture, and update documentation

This commit is contained in:
sha
2025-12-26 13:38:17 +00:00
parent 8f68624529
commit 91df347727
13 changed files with 170 additions and 76 deletions
+11 -17
View File
@@ -4,35 +4,29 @@ from renamer.extractors.metadata_extractor import MetadataExtractor
class TestMetadataExtractor:
@pytest.fixture
def extractor(self, test_file):
return MetadataExtractor(test_file)
@pytest.fixture
def test_file(self):
"""Use the filenames.txt file for testing"""
return Path(__file__).parent / "filenames.txt"
def test_extract_title(self, test_file):
def test_extract_title(self, extractor):
"""Test extracting title from metadata"""
title = MetadataExtractor.extract_title(test_file)
title = extractor.extract_title()
# Text files don't have metadata, so should be None
assert title is None
def test_extract_duration(self, test_file):
def test_extract_duration(self, extractor):
"""Test extracting duration from metadata"""
duration = MetadataExtractor.extract_duration(test_file)
duration = extractor.extract_duration()
# Text files don't have duration
assert duration is None
def test_extract_artist(self, test_file):
def test_extract_artist(self, extractor):
"""Test extracting artist from metadata"""
artist = MetadataExtractor.extract_artist(test_file)
artist = extractor.extract_artist()
# Text files don't have artist
assert artist is None
def test_extract_all_metadata(self, test_file):
"""Test extracting all metadata"""
metadata = MetadataExtractor.extract_all_metadata(test_file)
expected = {
'title': None,
'duration': None,
'artist': None
}
assert metadata == expected
assert artist is None