mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-01-06 14:52:50 +00:00
Add support for description field on playlist create/update
This commit is contained in:
parent
7499d8e511
commit
f5bb6db89f
@ -399,20 +399,21 @@ class Spotify(object):
|
|||||||
limit=limit, offset=offset, fields=fields,
|
limit=limit, offset=offset, fields=fields,
|
||||||
market=market)
|
market=market)
|
||||||
|
|
||||||
def user_playlist_create(self, user, name, public=True):
|
def user_playlist_create(self, user, name, public=True, description=''):
|
||||||
''' Creates a playlist for a user
|
''' Creates a playlist for a user
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
- user - the id of the user
|
- user - the id of the user
|
||||||
- name - the name of the playlist
|
- name - the name of the playlist
|
||||||
- public - is the created playlist public
|
- public - is the created playlist public
|
||||||
|
- description - the description of the playlist
|
||||||
'''
|
'''
|
||||||
data = {'name': name, 'public': public}
|
data = {'name': name, 'public': public, 'description': description}
|
||||||
return self._post("users/%s/playlists" % (user,), payload=data)
|
return self._post("users/%s/playlists" % (user,), payload=data)
|
||||||
|
|
||||||
def user_playlist_change_details(
|
def user_playlist_change_details(
|
||||||
self, user, playlist_id, name=None, public=None,
|
self, user, playlist_id, name=None, public=None,
|
||||||
collaborative=None):
|
collaborative=None, description=None):
|
||||||
''' Changes a playlist's name and/or public/private state
|
''' Changes a playlist's name and/or public/private state
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@ -421,6 +422,7 @@ class Spotify(object):
|
|||||||
- name - optional name of the playlist
|
- name - optional name of the playlist
|
||||||
- public - optional is the playlist public
|
- public - optional is the playlist public
|
||||||
- collaborative - optional is the playlist collaborative
|
- collaborative - optional is the playlist collaborative
|
||||||
|
- description - optional description of the playlist
|
||||||
'''
|
'''
|
||||||
data = {}
|
data = {}
|
||||||
if isinstance(name, six.string_types):
|
if isinstance(name, six.string_types):
|
||||||
@ -429,6 +431,8 @@ class Spotify(object):
|
|||||||
data['public'] = public
|
data['public'] = public
|
||||||
if isinstance(collaborative, bool):
|
if isinstance(collaborative, bool):
|
||||||
data['collaborative'] = collaborative
|
data['collaborative'] = collaborative
|
||||||
|
if isinstance(description, six.string_types):
|
||||||
|
data['description'] = description
|
||||||
return self._put("users/%s/playlists/%s" % (user, playlist_id),
|
return self._put("users/%s/playlists/%s" % (user, playlist_id),
|
||||||
payload=data)
|
payload=data)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user