works have cover and smol cover added
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-11-26 18:15:09 +01:00
parent e4cf442f7d
commit 410cef1106
2 changed files with 15 additions and 4 deletions

View File

@@ -38,7 +38,8 @@ class ItemApi(SpotifyUserStoreResource):
try:
imgurl = musicbrainzngs.get_image_list(currrelease['id'])['images']
if len(imgurl) > 0:
retdata['cover_url'] = imgurl[0]['image']
retdata['cover_url_small'] = imgurl[0]['thumbnails']['small']
retdata['cover_url'] = imgurl[0]['thumbnails']['large']
except Exception as e:
current_app.logger.warning(e)
if len(album_spot) > 0:
@@ -54,6 +55,7 @@ class ItemApi(SpotifyUserStoreResource):
artist_image = artist_spot[0]['images']
if len(artist_image) > 0:
retdata['cover_url'] = artist_image[0]['url']
retdata['cover_url_small'] = artist_image[len(artist_image)-1]['url']
elif item_type == 'work':
currwork = musicbrainzngs.get_work_by_id(itemid)['work']
work_spot = self.spotify.search(q=currwork['title'], type="track", limit=1)['tracks']['items']
@@ -63,6 +65,7 @@ class ItemApi(SpotifyUserStoreResource):
work_image = work_spot[0]['images']
if len(work_image) > 0:
retdata['cover_url'] = work_image[0]['url']
workdata['cover_url_small'] = work_image[len(work_image)-1]['url']
elif item_type == 'recording':
currrecording = musicbrainzngs.get_recording_by_id(itemid, includes=['artists', 'releases'])['recording']
recording_spot = self.spotify.search(q=currrecording['title'], type="track", limit=1)['tracks']['items']
@@ -76,7 +79,8 @@ class ItemApi(SpotifyUserStoreResource):
try:
imgurl = musicbrainzngs.get_image_list(currrlease['id'])['images']
if len(imgurl) > 0:
retdata['cover_url'] = imgurl[0]['image']
retdata['cover_url_small'] = imgurl[0]['thumbnails']['small']
retdata['cover_url'] = imgurl[0]['thumbnails']['large']
except Exception as e:
current_app.logger.warning(e)
if len(recording_spot) > 0: