self._add_albums_directory(albums, artistid)
# Show selected playlist
- def playlist(self, playlistid, playlistname, version = 2):
+ def playlist(self, playlistid, playlistname):
userid = self._get_login()
if (userid != 0):
- if version == 1:
- songs = self.groovesharkApiv1.playlistGetSongs(playlistid)
- else:
- songs = groovesharkApi.getPlaylistSongs(playlistid)
+ songs = groovesharkApi.getPlaylistSongs(playlistid)
self._add_songs_directory(songs, trackLabelFormat=NAME_ALBUM_ARTIST_LABEL, playlistid=playlistid, playlistname=playlistname)
else:
dialog = xbmcgui.Dialog()
# Remove song from playlist
def removePlaylistSong(self, playlistid, playlistname, songpos):
- dialog = xbmcgui.Dialog(version = 1)
- if dialog.yesno('Grooveshark XBMC', 'Delete this song from the Grooveshark playlist?') == True:
+ dialog = xbmcgui.Dialog()
+ if dialog.yesno('Grooveshark XBMC', 'Delete this song from', 'the Grooveshark playlist?') == True:
userid = self._get_login(version = 1)
if (userid != 0):
if self.groovesharkApiv1.playlistDeleteSong(playlistid, songpos) == 0:
else:
# Refresh to remove item from directory
xbmc.executebuiltin('XBMC.Notification(Grooveshark XBMC, Removed song from Grooveshark playlist, 1000, ' + thumbDef + ')')
- xbmc.executebuiltin("Container.Update(" + playlistUrl + "&id="+str(playlistid) + "&name=" + playlistname + "&version=1)")
+ xbmc.executebuiltin("Container.Update(" + playlistUrl + "&id="+str(playlistid) + "&name=" + playlistname + ")")
else:
dialog = xbmcgui.Dialog()
dialog.ok('Grooveshark XBMC', 'You must be logged in', 'to delete a song from a Grooveshark playlist.')
grooveshark.album(id)
elif mode==MODE_PLAYLIST:
- version = 2
- try: version=urllib.unquote_plus(params["version"])
- except: pass
- grooveshark.playlist(id, name, version)
+ grooveshark.playlist(id, name)
elif mode==MODE_FAVORITE:
grooveshark.favorite(id)
else:
return 0
- def playlistGetSongs(self, playlistId):
- items = self.callRemote("playlist.getSongs", {"playlistID": playlistId})
- print items
- if 'result' in items:
- i = 0
- list = []
- index = ''
- l = -1
- try:
- if 'songs' in items['result'][0]:
- l = len(items['result'][0]['songs'])
- index = 'songs[]'
- except: pass
- try:
- if l < 0 and 'songs' in items['result']:
- l = len(items['result']['songs'])
- index = 'songs'
- except: pass
- try:
- if l < 0 and 'song' in items['result']:
- l = 1
- index = 'song'
- except: pass
- try:
- if l < 0:
- l = len(items['result'])
- except: pass
-
- while(i < l):
- if index == 'songs[]':
- s = items['result'][0]['songs'][i]
- elif index == 'songs':
- s = items['result'][index][i]
- elif index == 'song':
- s = items['result'][index]
- else:
- s = items['result'][i]
- if 'CoverArtFilename' not in s:
- info = self.getSongInfo(s['SongID'])
- coverart = info['CoverArtFilename']
- elif s['CoverArtFilename'] != None:
- coverart = THUMB_URL+s['CoverArtFilename'].encode('ascii', 'ignore')
- else:
- coverart = 'None'
- list.append([s['SongName'].encode('ascii', 'ignore'),\
- s['SongID'],\
- s['AlbumName'].encode('ascii', 'ignore'),\
- s['AlbumID'],\
- s['ArtistName'].encode('ascii', 'ignore'),\
- s['ArtistID'],\
- coverart])
- i = i + 1
- return list
- else:
- return []
-
-
- return list
-
def playlistDelete(self, playlistId):
if self.loggedIn == 1:
result = self.callRemote("playlist.delete", {"playlistID": playlistId})
#groovesharkApi = GrooveAPI()
#res = groovesharkApi.pingService()
#res = groovesharkApi.login(sys.argv[1], sys.argv[2])
-#songIDs = ['23404546','23401810','23401157']
-#res = groovesharkApi.createPlaylist("Test")
-#res = groovesharkApi.setPlaylistSongs(res, songIDs)
-#res = groovesharkApi.getPlaylistSongs(42251632)
+#songIDs = "[23404546,23401810,23401157]"
+#res = groovesharkApi.createPlaylist("Test", songIDs)
+#res = groovesharkApi.setPlaylistSongs('42873478', songIDs)
+#pprint.pprint(res)
+#res = groovesharkApi.getPlaylistSongs('42873478')
#res = groovesharkApi.getSongSearchResults('jimmy jazz', 3)
#res = groovesharkApi.getPopularSongsToday(3)
#res = groovesharkApi.getSongURLFromSongID('26579347')