From 47694c67cb4971beb6896b804847f1f49ed79e26 Mon Sep 17 00:00:00 2001 From: Jonathan Dye Date: Thu, 6 Jul 2017 19:30:52 +0100 Subject: [PATCH] Add loadalbum and addalbum commands --- pylms/player.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pylms/player.py b/pylms/player.py index 7639f1f..25c9af1 100644 --- a/pylms/player.py +++ b/pylms/player.py @@ -327,6 +327,32 @@ def playlist_erase(self, index): """Erase Item From Playlist""" self.request("playlist delete %i" % (index)) + def playlist_loadalbum(self, genre=None, artist=None, album=None): + """Add an album to the Playlist""" + if genre is None: + genre = '*' + genre = self.__quote(genre) + if artist is None: + artist = '*' + artist = self.__quote(artist) + if album is None: + album = '*' + album = self.__quote(album) + self.request("playlist loadalbum %s %s %s" % (genre, artist, album)) + + def playlist_addalbum(self, genre=None, artist=None, album=None): + """Add an album to the Playlist""" + if genre is None: + genre = '*' + genre = self.__quote(genre) + if artist is None: + artist = '*' + artist = self.__quote(artist) + if album is None: + album = '*' + album = self.__quote(album) + self.request("playlist addalbum %s %s %s" % (genre, artist, album)) + def playlist_track_count(self): """Get the amount of tracks in the current playlist""" return int(self.request('playlist tracks ?'))