mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-10-10 11:38:36 +00:00
Added playlist tracks method. Updated tests.
This commit is contained in:
@@ -279,7 +279,6 @@ class Spotify(object):
|
||||
|
||||
def user_playlist(self, user, playlist_id = None, fields=None):
|
||||
''' Gets playlist of a user
|
||||
|
||||
Parameters:
|
||||
- user - the id of the user
|
||||
- playlist_id - the id of the playlist
|
||||
@@ -288,8 +287,22 @@ class Spotify(object):
|
||||
if playlist_id == None:
|
||||
return self._get("users/%s/starred" % (user), fields=fields)
|
||||
plid = self._get_id('playlist', playlist_id)
|
||||
return self._get("users/%s/playlists/%s" % (user, plid),
|
||||
fields=fields)
|
||||
return self._get("users/%s/playlists/%s" % (user, plid), fields=fields)
|
||||
|
||||
def user_playlist_tracks(self, user, playlist_id = None, fields=None,
|
||||
limit=100, offset=0):
|
||||
''' Get full details of the tracks of a playlist owned by a user.
|
||||
|
||||
Parameters:
|
||||
- user - the id of the user
|
||||
- playlist_id - the id of the playlist
|
||||
- fields - which fields to return
|
||||
- limit - the maximum number of tracks to return
|
||||
- offset - the index of the first track to return
|
||||
'''
|
||||
plid = self._get_id('playlist', playlist_id)
|
||||
return self._get("users/%s/playlists/%s/tracks" % (user, plid),
|
||||
limit=limit, offset=offset, fields=fields)
|
||||
|
||||
def user_playlist_create(self, user, name, public=True):
|
||||
''' Creates a playlist for a user
|
||||
|
Reference in New Issue
Block a user