Importer will now pick embedded images in files with OTHER type if no COVER_FRONT is present

This commit is contained in:
Eliot Berriot 2019-01-15 17:14:11 +01:00
parent 11728bbbc4
commit 4a3c21a094
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
5 changed files with 20 additions and 8 deletions

View file

@ -147,14 +147,16 @@ def test_can_get_metadata_from_id3_mp3_file(field, value):
assert data.get(field) == value
@pytest.mark.parametrize("name", ["test.mp3", "sample.flac", "with_cover.ogg"])
@pytest.mark.parametrize(
"name", ["test.mp3", "with_other_picture.mp3", "sample.flac", "with_cover.ogg"]
)
def test_can_get_pictures(name):
path = os.path.join(DATA_DIR, name)
data = metadata.Metadata(path)
pictures = data.get("pictures")
assert len(pictures) == 1
cover_data = data.get_picture("cover_front")
cover_data = data.get_picture("cover_front", "other")
assert cover_data["mimetype"].startswith("image/")
assert len(cover_data["content"]) > 0
assert type(cover_data["content"]) == bytes