[rhythmbox] [artdisplay] Simplify save_pixbuf code



commit b289610d2f619c62b8608f068f4100e2f67de7e9
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 9 16:02:39 2009 +0000

    [artdisplay] Simplify save_pixbuf code
    
    https://bugzilla.gnome.org/show_bug.cgi?id=604189

 .../artdisplay/LocalCoverArtSearchGIO.py           |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/plugins/artdisplay/artdisplay/LocalCoverArtSearchGIO.py b/plugins/artdisplay/artdisplay/LocalCoverArtSearchGIO.py
index 25b2ace..f0b9ebc 100644
--- a/plugins/artdisplay/artdisplay/LocalCoverArtSearchGIO.py
+++ b/plugins/artdisplay/artdisplay/LocalCoverArtSearchGIO.py
@@ -137,7 +137,7 @@ class LocalCoverArtSearch:
 
 
 
-	def _pixbuf_save (self, pixbuf, uri):
+	def _pixbuf_save (self, pixbuf, file):
 		def pixbuf_cb(buf, stream):
 			# can't be bothered doing this asynchronously..
 			stream.write(buf)
@@ -150,8 +150,7 @@ class LocalCoverArtSearch:
 			except Exception,e :
 				print "error creating %s: %s" % (file.get_uri(), e)
 
-		f = gio.File(uri)
-		f.replace_async(replace_cb, user_data=pixbuf)
+		file.replace_async(replace_cb, user_data=pixbuf()
 
 	def _save_dir_cb (self, enum, result, (db, entry, dir, pixbuf)):
 		artist, album = [db.entry_get (entry, x) for x in [rhythmdb.PROP_ARTIST, rhythmdb.PROP_ALBUM]]
@@ -160,7 +159,7 @@ class LocalCoverArtSearch:
 			if len(files) == 0:
 				art_file = dir.resolve_relative_path(ART_SAVE_NAME)
 				print "saving local art to \"%s\"" % art_file.get_uri()
-				self._pixbuf_save (pixbuf, art_file.get_uri ())
+				self._pixbuf_save (pixbuf, art_file)
 				enum.close()
 				return
 



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