mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-10-12 17:10:45 +00:00
Adapted to new audio_features response
This commit is contained in:
1 parent
38ea4b6910
commit
9c0b872e86
2 files changed
+25
-1
No files matched your search
+7
-1
@@ -633,7 +633,13 @@ class Spotify(object):
|
||||
- tracks - a list of track URIs, URLs or IDs, maximum: 50 ids
|
||||
'''
|
||||
tlist = [self._get_id('track', t) for t in tracks]
|
||||
return self._get('audio-features?ids=' + ','.join(tlist))
|
||||
results = self._get('audio-features?ids=' + ','.join(tlist))
|
||||
# the response has changed, look for the new style first, and if
|
||||
# its not there, fallback on the old style
|
||||
if 'audio_attributes' in results:
|
||||
return results['audio_attributes']
|
||||
else:
|
||||
return results
|
||||
|
||||
def _get_id(self, type, id):
|
||||
fields = id.split(':')
|
||||
|
||||
Reference in new issue
Block a user