else:
return []
+ # Add song to user favorites
+ def addUserFavoriteSong(self, songID):
+ if (self.userID == 0):
+ return False;
+ result = self._callRemote('addUserFavoriteSong', {'sessionID' : self.sessionID, 'songID' : songID})
+ return result['result']['success']
+
# Get the url to link to a song on Grooveshark
def getSongURLFromSongID(self, songID):
song = GrooveSong(self.cacheDir)
# Creates a playlist with songs
def createPlaylist(self, name, songIDs):
result = self._callRemote('createPlaylist', {'name' : name, 'songIDs' : songIDs, 'sessionID' : self.sessionID})
- if 'result' in result and result['result']['success'] == 'true':
+ if 'result' in result and result['result']['success'] == True:
return result['result']['PlaylistID']
elif 'errors' in result:
return 0
# Sets the songs for a playlist
def setPlaylistSongs(self, playlistID, songIDs):
result = self._callRemote('setPlaylistSongs', {'playlistID' : playlistID, 'songIDs' : songIDs, 'sessionID' : self.sessionID})
- if 'result' in result and result['result']['success'] == 'true':
+ if 'result' in result and result['result']['success'] == True:
return True;
else:
return False;
# Test
-
+import sys
res = []
groovesharkApi = GrooveAPI('/tmp')
-#res = groovesharkApi.login('stephendenham', '*******')
+res = groovesharkApi.login(sys.argv[1], sys.argv[2])
#res = groovesharkApi.getSongSearchResults('jimmy jazz', 3)
#res = groovesharkApi.getPopularSongsToday()
#res = groovesharkApi.getSongURLFromSongID('27425375')
#res = groovesharkApi.getAlbumSearchResults('london calling', 3)
#res = groovesharkApi.getArtistSearchResults('the clash', 3)
#res = groovesharkApi.getUserFavoriteSongs()
-#res = groovesharkApi.getUserPlaylists()
-res = groovesharkApi.getSongInfo('27425375')
+res = groovesharkApi.getUserPlaylists()
+#res = groovesharkApi.getSongInfo('27425375')
#res = groovesharkApi.getPlaylistSongs(40902662)
+#res = groovesharkApi.addUserFavoriteSong('27425375')
-#pprint.pprint(res)
+pprint.pprint(res)