From e44bd7a93666002ad6d21581e2a39a7d9371f564 Mon Sep 17 00:00:00 2001 From: Brecht Yperman Date: Tue, 19 Feb 2019 00:47:07 +0100 Subject: [PATCH] Add library album management functions --- spotipy/client.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spotipy/client.py b/spotipy/client.py index 98a1e24..7c328fe 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -708,6 +708,28 @@ class Spotify(object): ''' return self._get('me/player/recently-played', limit=limit) + def current_user_saved_albums_delete(self, albums=[]): + """ Remove one or more albums from the current user's + "Your Music" library. + + Parameters: + - albums - a list of album URIs, URLs or IDs + """ + alist = [self._get_id('album', a) for a in albums] + r = self._delete('me/albums/?ids=' + ','.join(alist)) + return r + + def current_user_saved_albums_contains(self, albums=[]): + """ Check if one or more albums is already saved in + the current Spotify user’s “Your Music” library. + + Parameters: + - albums - a list of album URIs, URLs or IDs + """ + alist = [self._get_id('album', a) for a in albums] + r = self._get('me/albums/contains?ids=' + ','.join(alist)) + return r + def current_user_saved_albums_add(self, albums=[]): """ Add one or more albums to the current user's "Your Music" library.