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})
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:
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
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
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):
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):
f = open(path, 'rb')
radio = pickle.load(f)
f.close()
- print radio
except:
+ print "Failed to open " + path
radio = {}
radio['seedSongs'] = []
radio['seedArtists'] = []
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()