rhythmbox r6136 - in trunk: . plugins/jamendo/jamendo



Author: jmatthew
Date: Sun Jan 25 01:26:56 2009
New Revision: 6136
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6136&view=rev

Log:
2009-01-25  Jonathan Matthew  <jonathan d14n org>

	* plugins/jamendo/jamendo/JamendoSource.py:
	Parse track durations, protect against finish_loadscreen() being
	called twice due to gnome-vfs weirdness.  Fixes #569009.


Modified:
   trunk/ChangeLog
   trunk/plugins/jamendo/jamendo/JamendoSource.py

Modified: trunk/plugins/jamendo/jamendo/JamendoSource.py
==============================================================================
--- trunk/plugins/jamendo/jamendo/JamendoSource.py	(original)
+++ trunk/plugins/jamendo/jamendo/JamendoSource.py	Sun Jan 25 01:26:56 2009
@@ -78,6 +78,7 @@
 		self.__load_handle = None
 		self.__load_current_size = 0
 		self.__load_total_size = 0
+		self.__db_load_finished = False
 
 	def do_set_property(self, property, value):
 		if property.name == 'plugin':
@@ -182,7 +183,11 @@
 						except:
 							break
 					gtk.gdk.threads_leave()
-				gobject.idle_add (finish_loadscreen)
+					return False
+
+				if self.__db_load_finished is False:
+					gobject.idle_add (finish_loadscreen)
+					self.__db_load_finished = True
 			else:
 				# error reading file
 				raise exc_type
@@ -216,6 +221,7 @@
 
 	def __load_catalogue(self):
 		self.__notify_status_changed()
+		self.__db_load_finished = False
 		self.__load_handle = gnomevfs.async.open (local_song_info_uri, self.__load_catalogue_open_cb)
 
 
@@ -335,11 +341,13 @@
 					trackno = int(track['numalbum'])
 					if trackno >= 0:
 						self.__db.set(entry, rhythmdb.PROP_TRACK_NUMBER, trackno)
+
 					try:
-						self.__db.set(entry, rhythmdb.PROP_DURATION, int(track['lengths']))
+						duration = float(track['duration'])
+						self.__db.set(entry, rhythmdb.PROP_DURATION, int(duration))
 					except Exception:
 						# No length, nevermind
-						length = 0
+						pass
 					
 					# slight misuse, but this is far more efficient than having a python dict
 					# containing this data.



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