Playlist stuff.
[clinton/xbmc-groove.git] / resources / lib / GroovesharkAPI.py
index edfab77..a205924 100644 (file)
@@ -277,65 +277,6 @@ class GrooveAPIv1:
                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})
@@ -812,10 +753,11 @@ class GrooveAPI:
 #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')