This commit is contained in:
parent
9e212216a3
commit
71f4cddfc5
@ -161,8 +161,8 @@ class SingleListApi(SpotifyUserStoreResource):
|
|||||||
currartist = currrelease['release']['artist-credit'][0]['artist']
|
currartist = currrelease['release']['artist-credit'][0]['artist']
|
||||||
releasedata['artist'] = currartist['name']
|
releasedata['artist'] = currartist['name']
|
||||||
try:
|
try:
|
||||||
imgurl = musicbrainzngs.get_image_list(currrelease['id'])['images']
|
imgurl = musicbrainzngs.get_image_list(release['id'])['images']
|
||||||
if imgurl > 0:
|
if len(imgurl) > 0:
|
||||||
releasedata['cover_url'] = imgurl[0]['image']
|
releasedata['cover_url'] = imgurl[0]['image']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.warning(e)
|
current_app.logger.warning(e)
|
||||||
@ -207,8 +207,8 @@ class SingleListApi(SpotifyUserStoreResource):
|
|||||||
currrlease = currrecording['recording']['release-list'][0]
|
currrlease = currrecording['recording']['release-list'][0]
|
||||||
currrec['album'] = currrlease['title']
|
currrec['album'] = currrlease['title']
|
||||||
try:
|
try:
|
||||||
imgurl = musicbrainzngs.get_image_list(currrlease['id'])['images']
|
imgurl = musicbrainzngs.get_image_list(recording['id'])['images']
|
||||||
if imgurl > 0:
|
if len(imgurl) > 0:
|
||||||
currrec['cover_url'] = imgurl[0]['image']
|
currrec['cover_url'] = imgurl[0]['image']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.warning(e)
|
current_app.logger.warning(e)
|
||||||
@ -242,13 +242,14 @@ class ItemApi(SpotifyUserStoreResource):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.warning(e)
|
current_app.logger.warning(e)
|
||||||
abort(404, "unknown item")
|
abort(404, "unknown item")
|
||||||
|
|
||||||
if item_type == 'release':
|
if item_type == 'release':
|
||||||
currrelease = musicbrainzngs.get_release_by_id(itemid, includes=['artists'])['release']
|
currrelease = musicbrainzngs.get_release_by_id(itemid, includes=['artists'])['release']
|
||||||
album_spot = self.spotify.search(q=currrelease['title'], type="album", limit=1)['albums']['items']
|
album_spot = self.spotify.search(q=currrelease['title'], type="album", limit=1)['albums']['items']
|
||||||
retdata = {"id": itemid, "album": currrelease['title']}
|
retdata = {"id": itemid, "album": currrelease['title']}
|
||||||
try:
|
try:
|
||||||
imgurl = musicbrainzngs.get_image_list(currrelease['id'])['images']
|
imgurl = musicbrainzngs.get_image_list(currrelease['id'])['images']
|
||||||
if imgurl > 0:
|
if len(imgurl) > 0:
|
||||||
retdata['cover_url'] = imgurl[0]['image']
|
retdata['cover_url'] = imgurl[0]['image']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.warning(e)
|
current_app.logger.warning(e)
|
||||||
@ -271,6 +272,9 @@ class ItemApi(SpotifyUserStoreResource):
|
|||||||
retdata = {"id": itemid, "title": currwork['title']}
|
retdata = {"id": itemid, "title": currwork['title']}
|
||||||
if len(work_spot) > 0:
|
if len(work_spot) > 0:
|
||||||
retdata['spotify_id'] = f"spotify:track:{work_spot[0]['id']}"
|
retdata['spotify_id'] = f"spotify:track:{work_spot[0]['id']}"
|
||||||
|
work_image = work_spot[0]['images']
|
||||||
|
if len(work_image) > 0:
|
||||||
|
retdata['cover_url'] = work_image[0]['url']
|
||||||
elif item_type == 'recording':
|
elif item_type == 'recording':
|
||||||
currrecording = musicbrainzngs.get_recording_by_id(itemid, includes=['artists', 'releases'])['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']
|
recording_spot = self.spotify.search(q=currrecording['title'], type="track", limit=1)['tracks']['items']
|
||||||
@ -283,7 +287,7 @@ class ItemApi(SpotifyUserStoreResource):
|
|||||||
retdata['album'] = currrlease['title']
|
retdata['album'] = currrlease['title']
|
||||||
try:
|
try:
|
||||||
imgurl = musicbrainzngs.get_image_list(currrlease['id'])['images']
|
imgurl = musicbrainzngs.get_image_list(currrlease['id'])['images']
|
||||||
if imgurl > 0:
|
if len(imgurl) > 0:
|
||||||
retdata['cover_url'] = imgurl[0]['image']
|
retdata['cover_url'] = imgurl[0]['image']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.warning(e)
|
current_app.logger.warning(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user