[music] Fix error when mb fails
This commit is contained in:
@ -108,9 +108,12 @@ def lookup_track_from_mb(
|
|||||||
) -> str:
|
) -> str:
|
||||||
musicbrainzngs.set_useragent("vrobbler", "0.3.0")
|
musicbrainzngs.set_useragent("vrobbler", "0.3.0")
|
||||||
|
|
||||||
top_result = musicbrainzngs.search_recordings(
|
try:
|
||||||
query=track_name, artist=artist_mbid, release=album_mbid
|
top_result = musicbrainzngs.search_recordings(
|
||||||
)["recording-list"][0]
|
query=track_name, artist=artist_mbid, release=album_mbid
|
||||||
|
)["recording-list"][0]
|
||||||
|
except IndexError:
|
||||||
|
return ""
|
||||||
score = int(top_result.get("ext:score"))
|
score = int(top_result.get("ext:score"))
|
||||||
if score < 85:
|
if score < 85:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|||||||
Reference in New Issue
Block a user