X-Git-Url: https://git.hcoop.net/clinton/xbmc-groove.git/blobdiff_plain/973b4c6ce5e47891769f1219a7f7f5d2c75287db..15eeae947f0fa992d79dc6a36e4fbbef99b05675:/resources/lib/GrooveAPI.py diff --git a/resources/lib/GrooveAPI.py b/resources/lib/GrooveAPI.py index e97d04d..d83989e 100644 --- a/resources/lib/GrooveAPI.py +++ b/resources/lib/GrooveAPI.py @@ -284,6 +284,16 @@ class GrooveAPI: return 0 else: return 0 + + def playlistCreateUnique(self, name, songIds): + if self.loggedIn == 1: + result = self.callRemote("playlist.createunique", {"name": name, "songIDs": songIds}) + if 'result' in result: + return result['result']['playlistID'] + else: + return 0 + else: + return 0 def playlistGetSongs(self, playlistId, limit=25): result = self.callRemote("playlist.getSongs", {"playlistID": playlistId}) @@ -317,6 +327,16 @@ class GrooveAPI: return 1 else: return 0 + + def playlistDeleteSong(self, playlistId, position): + if self.loggedIn == 1: + result = self.callRemote("playlist.removeSong", {"playlistID": playlistId, "position": position}) + if 'fault' in result: + return 0 + else: + return 1 + else: + return 0 def playlistReplace(self, playlistId, songIds): if self.loggedIn == 1: @@ -334,6 +354,7 @@ class GrooveAPI: return False result = self.callRemote("autoplay.startWithArtistIDs", {"artistIDs": radio['seedArtists']}) if 'fault' in result: + print "Cannot autoplay artists" self.radioEnabled = False else: self.radioEnabled = True @@ -345,6 +366,7 @@ class GrooveAPI: return False result = self.callRemote("autoplay.start", {"songIDs": radio['seedSongs']}) if 'fault' in result: + print "Cannot autoplay songs" self.radioEnabled = False else: self.radioEnabled = True @@ -382,8 +404,10 @@ class GrooveAPI: radio['seedArtists'].remove(artistId) except: pass radio['seedArtists'].append(artistId) + print "Saved radio" return self.saveRadio(radio = radio) else: + print "Failed to get radio" return False def radioSong(self, songId = None): @@ -393,8 +417,10 @@ class GrooveAPI: radio['seedSongs'].remove(songId) except: pass radio['seedSongs'].append(songId) + print "Saved radio" return self.saveRadio(radio = radio) else: + print "Failed to get radio" return False def radioTurnedOn(self): @@ -406,8 +432,8 @@ class GrooveAPI: f = open(path, 'rb') radio = pickle.load(f) f.close() - print radio except: + print "Failed to open " + path radio = {} radio['seedSongs'] = [] radio['seedArtists'] = [] @@ -619,7 +645,7 @@ class GrooveAPI: s['artistID'],\ s['albumName'].encode('ascii', 'ignore'),\ s['albumID'],\ - s['image']['tiny'].encode('ascii', 'ignore')]) + s['image']['medium'].encode('ascii', 'ignore')]) except: print 'GrooveShark: Could not parse album number: ' + str(i) traceback.print_exc()