Compare commits
No commits in common. "811cfc929ee32cd57391f317e743f16fc216a81a" and "ecaec93819d2a2679b0a3f73b73424551b67bf26" have entirely different histories.
811cfc929e
...
ecaec93819
@ -25,25 +25,32 @@ class APIInteractionResource(UserStoreResource):
|
|||||||
spotify_uri = "spotify:"
|
spotify_uri = "spotify:"
|
||||||
if mb_type == "artist":
|
if mb_type == "artist":
|
||||||
spot_data = self.spotify.search(q=querystring, type="artist", limit=1)['artists']['items']
|
spot_data = self.spotify.search(q=querystring, type="artist", limit=1)['artists']['items']
|
||||||
if not spot_data:
|
|
||||||
return None, None, None
|
|
||||||
spotify_uri += "artist:"
|
spotify_uri += "artist:"
|
||||||
|
if spot_data:
|
||||||
imagedata = spot_data[0]['images']
|
imagedata = spot_data[0]['images']
|
||||||
elif mb_type == "release":
|
else:
|
||||||
spot_data = self.spotify.search(q=querystring, type="artist", limit=1).get('albums')
|
|
||||||
if not spot_data:
|
|
||||||
return None, None, None
|
return None, None, None
|
||||||
|
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']
|
spot_data = spot_data['items']
|
||||||
|
else:
|
||||||
|
return None, None, None
|
||||||
spotify_uri += "album:"
|
spotify_uri += "album:"
|
||||||
|
if spot_data:
|
||||||
imagedata = spot_data[0]['images']
|
imagedata = spot_data[0]['images']
|
||||||
|
else:
|
||||||
|
return None, None, None
|
||||||
elif mb_type == "work" or mb_type == "recording":
|
elif mb_type == "work" or mb_type == "recording":
|
||||||
spot_data = self.spotify.search(q=querystring, type="track", limit=1)['tracks']['items']
|
spot_data = self.spotify.search(q=querystring, type="track", limit=1)['tracks']['items']
|
||||||
if not spot_data:
|
|
||||||
return None, None, None
|
|
||||||
spotify_uri += "track:"
|
spotify_uri += "track:"
|
||||||
|
if spot_data:
|
||||||
imagedata = spot_data[0]['album']['images']
|
imagedata = spot_data[0]['album']['images']
|
||||||
else:
|
else:
|
||||||
return None, None, None
|
return None, None, None
|
||||||
|
else:
|
||||||
|
return None, None, None
|
||||||
|
|
||||||
spotify_uri += spot_data[0]['id']
|
spotify_uri += spot_data[0]['id']
|
||||||
if imagedata:
|
if imagedata:
|
||||||
|
Loading…
Reference in New Issue
Block a user