See #170: add a description field on tracks, albums, tracks

This commit is contained in:
Eliot Berriot 2020-01-14 14:00:08 +01:00
parent 424b9f133a
commit 2bc71eecfd
38 changed files with 653 additions and 59 deletions

View file

@ -30,6 +30,7 @@ DATA_DIR = os.path.dirname(os.path.abspath(__file__))
),
("license", "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/"),
("copyright", "Someone"),
("comment", "Hello there"),
],
)
def test_can_get_metadata_from_ogg_file(field, value):
@ -58,6 +59,7 @@ def test_can_get_metadata_all():
"license": "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/",
"copyright": "Someone",
"genre": "Classical",
"comment": "Hello there",
}
assert data.all() == expected
@ -81,6 +83,7 @@ def test_can_get_metadata_all():
),
("license", "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/"),
("copyright", "Someone"),
("comment", "Hello there"),
],
)
def test_can_get_metadata_from_opus_file(field, value):
@ -104,6 +107,7 @@ def test_can_get_metadata_from_opus_file(field, value):
("mbid", "124d0150-8627-46bc-bc14-789a3bc960c8"),
("musicbrainz_artistid", "c3bc80a6-1f4a-4e17-8cf0-6b1efe8302f1"),
("musicbrainz_albumartistid", "c3bc80a6-1f4a-4e17-8cf0-6b1efe8302f1"),
("comment", "Hello there"),
# somehow, I cannot successfully create an ogg theora file
# with the proper license field
# ("license", "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/"),
@ -132,6 +136,7 @@ def test_can_get_metadata_from_ogg_theora_file(field, value):
("musicbrainz_albumartistid", "9c6bddde-6228-4d9f-ad0d-03f6fcb19e13"),
("license", "https://creativecommons.org/licenses/by-nc-nd/2.5/"),
("copyright", "Someone"),
("comment", "Hello there"),
],
)
def test_can_get_metadata_from_id3_mp3_file(field, value):
@ -181,6 +186,7 @@ def test_can_get_pictures(name):
("musicbrainz_albumartistid", "b7ffd2af-418f-4be2-bdd1-22f8b48613da"),
("license", "http://creativecommons.org/licenses/by-nc-sa/3.0/us/"),
("copyright", "2008 nin"),
("comment", "Hello there"),
],
)
def test_can_get_metadata_from_flac_file(field, value):
@ -210,6 +216,7 @@ def test_can_get_metadata_from_flac_file(field, value):
("license", "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/"),
("copyright", "Someone"),
("genre", "Dubstep"),
("comment", "Hello there"),
],
)
def test_can_get_metadata_from_m4a_file(field, value):
@ -294,6 +301,7 @@ def test_metadata_fallback_ogg_theora(mocker):
"license": "https://creativecommons.org/licenses/by-nc-nd/2.5/",
"copyright": "Someone",
"tags": ["Funk"],
"description": {"text": "Hello there", "content_type": "text/plain"},
},
),
(
@ -327,6 +335,7 @@ def test_metadata_fallback_ogg_theora(mocker):
"license": "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/",
"copyright": "Someone",
"tags": ["Classical"],
"description": {"text": "Hello there", "content_type": "text/plain"},
},
),
(
@ -360,6 +369,7 @@ def test_metadata_fallback_ogg_theora(mocker):
"license": "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/",
"copyright": "Someone",
"tags": ["Classical"],
"description": {"text": "Hello there", "content_type": "text/plain"},
},
),
(
@ -391,6 +401,7 @@ def test_metadata_fallback_ogg_theora(mocker):
# with the proper license field
# ("license", "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/"),
"copyright": "℗ 2012 JKP GmbH & Co. KG",
"description": {"text": "Hello there", "content_type": "text/plain"},
},
),
(
@ -420,6 +431,7 @@ def test_metadata_fallback_ogg_theora(mocker):
"license": "http://creativecommons.org/licenses/by-nc-sa/3.0/us/",
"copyright": "2008 nin",
"tags": ["Industrial"],
"description": {"text": "Hello there", "content_type": "text/plain"},
},
),
],
@ -528,10 +540,12 @@ def test_fake_metadata_with_serializer():
"musicbrainz_albumartistid": "013c8e5b-d72a-4cd3-8dee-6c64d6125823;5b4d7d2d-36df-4b38-95e3-a964234f520f",
"license": "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/",
"copyright": "Someone",
"comment": "hello there",
}
expected = {
"title": "Peer Gynt Suite no. 1, op. 46: I. Morning",
"description": {"text": "hello there", "content_type": "text/plain"},
"artists": [
{
"name": "Edvard Grieg",