[gnome-music] albumArtCache: don't check artist-album combination again if it was not found before



commit ee2bf0e5f929c64dbf4fd85121668b71c7aa5e82
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Mon Apr 28 13:22:45 2014 +0200

    albumArtCache: don't check artist-album combination again if it was not found before

 gnomemusic/albumArtCache.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/albumArtCache.py b/gnomemusic/albumArtCache.py
index 40ed0f3..a0f8f8a 100644
--- a/gnomemusic/albumArtCache.py
+++ b/gnomemusic/albumArtCache.py
@@ -77,6 +77,7 @@ def _make_icon_frame(pixbuf, path=None):
 
 class AlbumArtCache:
     instance = None
+    blacklist = {}
 
     @classmethod
     def get_default(self):
@@ -148,6 +149,9 @@ class AlbumArtCache:
     def lookup_worker(self, item, width, height, callback, itr, artist, album):
         try:
             path = MediaArt.get_path(artist, album, "album", None)[0]
+            if artist in self.blacklist and album in self.blacklist[artist]:
+                self.finish(None, path, callback, itr)
+                return
             if not os.path.exists(path):
                 GLib.idle_add(self.cached_thumb_not_found, item, width, height, path, callback, itr, artist, 
album)
                 return
@@ -185,6 +189,11 @@ class AlbumArtCache:
         try:
             uri = item.get_thumbnail()
             if uri is None:
+                # Blacklist artist-album combination
+                if artist not in self.blacklist:
+                    self.blacklist[artist] = []
+                self.blacklist[artist].append(album)
+
                 logger.warn("can't find URL for album '%s' by %s" % (album, artist))
                 self.finish(None, path, callback, itr)
                 return


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]