X-Git-Url: http://git.hcoop.net/clinton/xbmc-groove.git/blobdiff_plain/db319cef495e7ed27fa6f1c6988524931572c83e..57ffc218c83ea9ea4923afe6f1c2b762b7157edf:/default.py diff --git a/default.py b/default.py index 7e6b392..785ddec 100644 --- a/default.py +++ b/default.py @@ -240,7 +240,7 @@ class Grooveshark: popularSongsArtistImg = xbmc.translatePath(os.path.join(imgDir, 'popularSongsArtist.png')) songImg = xbmc.translatePath(os.path.join(imgDir, 'song.png')) defImg = xbmc.translatePath(os.path.join(imgDir, 'default.tbn')) - fanImg = xbmc.translatePath(os.path.join(baseDir, 'fanart.png')) + fanImg = xbmc.translatePath(os.path.join(baseDir, 'fanart.jpg')) settings = xbmcaddon.Addon(id='plugin.audio.groove') songsearchlimit = int(settings.getSetting('songsearchlimit')) @@ -353,7 +353,7 @@ class Grooveshark: artistID = artist[1] if __debugging__ : xbmc.log("Found " + artist[0] + "...") - albums = groovesharkApi.getArtistAlbums(artistID, limit = self.albumsearchlimit) + albums = groovesharkApi.getArtistAlbums(artistID, self.albumsearchlimit) if (len(albums) > 0): self._add_albums_directory(albums, artistID) else: @@ -440,7 +440,7 @@ class Grooveshark: # Show selected artist def artist(self, artistid): albums = groovesharkApi.getArtistAlbums(artistid, limit = self.albumsearchlimit) - self._add_albums_directory(albums, artistid) + self._add_albums_directory(albums, artistid, True) # Show selected playlist def playlist(self, playlistid, playlistname): @@ -797,7 +797,7 @@ class Grooveshark: xbmcplugin.setPluginFanart(int(sys.argv[1]), self.fanImg) # Add albums to directory - def _add_albums_directory(self, albums, artistid=0): + def _add_albums_directory(self, albums, artistid=0, isverified=False): n = len(albums) itemsExisting = n if __debugging__ : @@ -806,7 +806,7 @@ class Grooveshark: while i < n: album = albums[i] albumID = album[3] - if groovesharkApi.getDoesAlbumExist(albumID): + if isverified or groovesharkApi.getDoesAlbumExist(albumID): albumArtistName = album[0] albumName = album[2] albumImage = self._get_icon(album[4], 'album-' + str(albumID)) @@ -910,7 +910,7 @@ class Grooveshark: id = int(songid) duration = -1 durations = [] - path = os.path.join(cacheDir, 'durations.dmp') + path = os.path.join(cacheDir, 'duration.dmp') try: f = open(path, 'rb') durations = pickle.load(f) @@ -922,12 +922,13 @@ class Grooveshark: except: pass - # Not in cache but exists - if duration < 0 and groovesharkApi.getDoesSongExist(songid): + # Not in cache + if duration < 0: stream = groovesharkApi.getSubscriberStreamKey(songid) - duration = self._setDuration(stream['uSecs']) - song = [id, duration] - self._setSongDuration(song, durations) + if stream != False and stream['url'] != '': + duration = self._setDuration(stream['uSecs']) + song = [id, duration] + self._setSongDuration(song, durations) return duration @@ -937,7 +938,7 @@ class Grooveshark: # Create the cache directory if it doesn't exist. if not os.path.exists(cacheDir): os.makedirs(cacheDir) - path = os.path.join(cacheDir, 'durations.dmp') + path = os.path.join(cacheDir, 'duration.dmp') f = open(path, 'wb') pickle.dump(durations, f, protocol=pickle.HIGHEST_PROTOCOL) f.close()