Recommendations seeds parameters formatted as a comma seperated list to

comply with Spotify API. Fixes problem of only first
seed_artist/track/genre being used to generate recommendations.

Mltiple params in the form of "seed_artist=xxxx&seed_artists=yyyy"
results in Spotify API ignoring everything but the first parameter.
This commit is contained in:
steinitzu 2016-10-24 12:19:08 -04:00
parent 3f87a8b879
commit 1304ac33c0

View File

@ -676,11 +676,13 @@ class Spotify(object):
''' '''
params = dict(limit=limit) params = dict(limit=limit)
if seed_artists: if seed_artists:
params['seed_artists'] = [self._get_id('artist', a) for a in seed_artists] params['seed_artists'] = ','.join(
[self._get_id('artist', a) for a in seed_artists])
if seed_genres: if seed_genres:
params['seed_genres'] = seed_genres params['seed_genres'] = ','.join(seed_genres)
if seed_tracks: if seed_tracks:
params['seed_tracks'] = [self._get_id('track', t) for t in seed_tracks] params['seed_tracks'] = ','.join(
[self._get_id('track', t) for t in seed_tracks])
if country: if country:
params['market'] = country params['market'] = country