[gnome-music] Fix bug where downloaded artwork did not replace existing ones



commit ff5464d4f771d622e76c93a5c52b6a527d49d843
Author: Seif Lotfy <seif lotfy com>
Date:   Thu May 16 12:33:16 2013 +0200

    Fix bug where downloaded artwork did not replace existing ones

 src/albumArtCache.js |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/albumArtCache.js b/src/albumArtCache.js
index b40444e..fb7bbf3 100644
--- a/src/albumArtCache.js
+++ b/src/albumArtCache.js
@@ -77,7 +77,7 @@ const AlbumArtCache = new Lang.Class({
             }
             catch (error) {
                 if (this.logLookupErrors)
-                    log(error);
+                    print ("ERROR:", error);
             }
         }
 
@@ -131,8 +131,14 @@ const AlbumArtCache = new Lang.Class({
 
         file.read_async(300, null, Lang.bind(this, function(source, res, user_data) {
             try {
-                let stream = file.read_finish(res),
+                let stream = file.read_finish(res);
                     new_file = Gio.File.new_for_path(path);
+
+                if (new_file.query_exists(null)) {
+                    new_file.delete(null);
+                    new_file = Gio.File.new_for_path(path);
+                }
+
                 new_file.append_to_async(Gio.FileCreateFlags.REPLACE_DESTINATION,
                     300, null, Lang.bind(this, function (new_file, res, error) {
                     let outstream = new_file.append_to_finish(res);


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