[gnome-music] albumArtCache: Don't return path if doesn't exists



commit be1118a3c8fb8c588cbff7443ff22522196f823f
Author: Arnel Borja <arnelborja src gnome org>
Date:   Mon Apr 28 19:53:00 2014 +0800

    albumArtCache: Don't return path if doesn't exists
    
    Since an invalid path is used by notification to know if the media art
    is found, return None if it doesn't exists.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729102

 gnomemusic/albumArtCache.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/albumArtCache.py b/gnomemusic/albumArtCache.py
index c0d7184..26a13e4 100644
--- a/gnomemusic/albumArtCache.py
+++ b/gnomemusic/albumArtCache.py
@@ -150,7 +150,7 @@ class AlbumArtCache:
         try:
             path = MediaArt.get_path(artist, album, "album", None)[0]
             if artist in self.blacklist and album in self.blacklist[artist]:
-                self.finish(item, None, path, callback, itr)
+                self.finish(item, None, None, 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)
@@ -165,7 +165,8 @@ class AlbumArtCache:
     @log
     def finish(self, item, pixbuf, path, callback, itr):
         try:
-            item.set_thumbnail(GLib.filename_to_uri(path, None))
+            if path:
+                item.set_thumbnail(GLib.filename_to_uri(path, None))
             GLib.idle_add(callback, pixbuf, path, itr)
         except Exception as e:
             logger.warn("Error: %s" % e)
@@ -196,7 +197,7 @@ class AlbumArtCache:
                 self.blacklist[artist].append(album)
 
                 logger.warn("can't find URL for album '%s' by %s" % (album, artist))
-                self.finish(item, None, path, callback, itr)
+                self.finish(item, None, None, callback, itr)
                 return
 
             start_new_thread(self.download_worker, (item, width, height, path, callback, itr, artist, album, 
uri))


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