Compare commits
2 Commits
ecaec93819
...
811cfc929e
Author | SHA1 | Date | |
---|---|---|---|
811cfc929e | |||
19ea61e339 |
@ -25,30 +25,23 @@ class APIInteractionResource(UserStoreResource):
|
||||
spotify_uri = "spotify:"
|
||||
if mb_type == "artist":
|
||||
spot_data = self.spotify.search(q=querystring, type="artist", limit=1)['artists']['items']
|
||||
if not spot_data:
|
||||
return None, None, None
|
||||
spotify_uri += "artist:"
|
||||
if spot_data:
|
||||
imagedata = spot_data[0]['images']
|
||||
else:
|
||||
return None, None, None
|
||||
imagedata = spot_data[0]['images']
|
||||
elif mb_type == "release":
|
||||
spot_data = self.spotify.search(q=querystring, type="artist", limit=1).get(
|
||||
'albums')
|
||||
if spot_data:
|
||||
spot_data = spot_data['items']
|
||||
else:
|
||||
spot_data = self.spotify.search(q=querystring, type="artist", limit=1).get('albums')
|
||||
if not spot_data:
|
||||
return None, None, None
|
||||
spot_data = spot_data['items']
|
||||
spotify_uri += "album:"
|
||||
if spot_data:
|
||||
imagedata = spot_data[0]['images']
|
||||
else:
|
||||
return None, None, None
|
||||
imagedata = spot_data[0]['images']
|
||||
elif mb_type == "work" or mb_type == "recording":
|
||||
spot_data = self.spotify.search(q=querystring, type="track", limit=1)['tracks']['items']
|
||||
spotify_uri += "track:"
|
||||
if spot_data:
|
||||
imagedata = spot_data[0]['album']['images']
|
||||
else:
|
||||
if not spot_data:
|
||||
return None, None, None
|
||||
spotify_uri += "track:"
|
||||
imagedata = spot_data[0]['album']['images']
|
||||
else:
|
||||
return None, None, None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user