Skip to content
Snippets Groups Projects
Commit b36ed8a6 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch '214-flac-no-mbid' into 'develop'

Resolve "Flac import fails if no MusicBrainz-ID present"

Closes #214

See merge request funkwhale/funkwhale!208
parents bcef31c1 01ea6562
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ def get_id3_tag(f, k):
def get_flac_tag(f, k):
try:
return f.get(k)[0]
return f.get(k, [])[0]
except (KeyError, IndexError):
raise TagNotFound(k)
......@@ -158,6 +158,9 @@ CONF = {
'musicbrainz_recordingid': {
'field': 'musicbrainz_trackid'
},
'test': {
'field': 'test'
},
}
},
}
......
......@@ -57,3 +57,11 @@ def test_can_get_metadata_from_flac_file(field, value):
data = metadata.Metadata(path)
assert data.get(field) == value
def test_can_get_metadata_from_flac_file_not_crash_if_empty():
path = os.path.join(DATA_DIR, 'sample.flac')
data = metadata.Metadata(path)
with pytest.raises(metadata.TagNotFound):
data.get('test')
Do not crash on flac import if musicbrainz tags are missing (#214)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment