bum
bum copied to clipboard
Fails if song metadata does not contain an "album" property
In some cases a downloaded, single song (in this case, Dark all Day by GUNSHIP grabbed from BandCamp) may not have an "album" associated with it.
This causes a hard fail where it's assumed "album" exists, for example in brainz.py
:
data = mus.search_releases(artist=song["artist"],
release=song["album"],
limit=1)
This can be fixed by using "title" in lieu of "album", and this seems to correctly fetch the album art too:
artist = song.get("artist")
title = song.get("title")
album = song.get("album", title)
data = mus.search_releases(artist=artist,
release=album,
limit=1)
I'm happy to do a PR to fix this, but can anyone think of instances where this might fail?
It might be worth running a series of tests on a large number of files.
I'll have to find someone who actually has a music collection.
A short term approach might be to trap the exception that occurs when trying to pull a non-existent "album" value and fail with default art.
That's probably a better solution as this is an album art display tool and singles do still usually contain the album
field.
I decided not to open a new issue, but the same bug occurs when the "artist" field is blank. I agree about the default art. I have a large music collection to run tests against, just FYI.