From 5d3b12f28851c8b4919564783165ad173ee9c32c Mon Sep 17 00:00:00 2001 From: stephendenham Date: Sat, 8 Oct 2011 09:15:49 +0000 Subject: [PATCH] Tuning. git-svn-id: svn://svn.code.sf.net/p/xbmc-groove/code@66 2dec19e3-eb1d-4749-8193-008c8bba0994 --- addon.xml | 2 +- changelog.txt | 4 ++++ default.py | 23 ++++++++++++----------- description.xml | 2 +- resources/settings.xml | 2 +- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/addon.xml b/addon.xml index 7827afb..050f00e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,6 +1,6 @@ + version="0.6.3" provider-name="Stephen Denham"> diff --git a/changelog.txt b/changelog.txt index 5608c3f..f90acd5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +0.6.3 + +Speed improvements. + 0.6.2 Check item existence before adding to directory. diff --git a/default.py b/default.py index 7e6b392..7742c24 100644 --- a/default.py +++ b/default.py @@ -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, True) 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() diff --git a/description.xml b/description.xml index 420a647..a14fb62 100644 --- a/description.xml +++ b/description.xml @@ -18,7 +18,7 @@ Grooveshark XBMC - 0.6.2 + 0.6.3