kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Merge branch '214-flac-no-mbid' into 'develop'
Resolve "Flac import fails if no MusicBrainz-ID present" Closes #214 See merge request funkwhale/funkwhale!208merge-requests/237/head
commit
b36ed8a699
|
@ -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')
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Do not crash on flac import if musicbrainz tags are missing (#214)
|
Ładowanie…
Reference in New Issue