Commit 787d171a authored by Gink's avatar Gink

Fix edge cases

parent 6257f2d2
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import pprint import pprint
import musicbrainzngs import musicbrainzngs
from musicbrainzngs import ResponseError from musicbrainzngs import ResponseError
from musicbrainzngs import NetworkError
from core.models import Album from core.models import Album
pp = pprint.PrettyPrinter(indent=4) pp = pprint.PrettyPrinter(indent=4)
...@@ -18,12 +19,12 @@ def verifyAlbumArt(album, artist): ...@@ -18,12 +19,12 @@ def verifyAlbumArt(album, artist):
def fetchAlbumArt(name, artist): def fetchAlbumArt(name, artist):
debug("GET " + name + " " + artist) debug("GET " + name + " " + artist)
results = musicbrainzngs.search_release_groups(name, limit = 3, artistname=artist, primarytype="album")
#pp.pprint(results['release-group-list'])
results = results['release-group-list']
resultid = results[0]['id']
debug("ID = " + resultid)
try: try:
results = musicbrainzngs.search_release_groups(name, limit = 3, artistname=artist, primarytype="album")
#pp.pprint(results['release-group-list'])
results = results['release-group-list']
resultid = results[0]['id']
debug("ID = " + resultid)
imagelist = musicbrainzngs.get_release_group_image_list(resultid) imagelist = musicbrainzngs.get_release_group_image_list(resultid)
except ResponseError: except ResponseError:
debug("No image found.") debug("No image found.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment