rhythmbox r6274 - in trunk: . plugins/magnatune/magnatune



Author: jmatthew
Date: Mon Apr  6 03:50:21 2009
New Revision: 6274
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6274&view=rev

Log:
2009-04-06  Jonathan Matthew  <jonathan d14n org>

	* plugins/magnatune/magnatune/MagnatuneSource.py:
	Catch parser exceptions and sort of pretend we can keep going, though
	all that will show up in the track list will be what we parsed before
	the error.  Fixes #574465.

	Replace a couple of strange characters that appear in the XML with
	best guesses as to what they're supposed to be.  This lets us parse
	the current catalog file successfully.


Modified:
   trunk/ChangeLog
   trunk/plugins/magnatune/magnatune/MagnatuneSource.py

Modified: trunk/plugins/magnatune/magnatune/MagnatuneSource.py
==============================================================================
--- trunk/plugins/magnatune/magnatune/MagnatuneSource.py	(original)
+++ trunk/plugins/magnatune/magnatune/MagnatuneSource.py	Mon Apr  6 03:50:21 2009
@@ -304,7 +304,12 @@
 				# report error somehow?
 				print "error loading catalogue: %s" % result
 
-			parser.close ()
+			try:
+				parser.close ()
+			except xml.sax.SAXParseException, e:
+				# there isn't much we can do here
+				print "error parsing catalogue: %s" % e
+
 			self.__show_loading_screen (False)
 			self.__updating = False
 			self.__catalogue_loader = None
@@ -319,7 +324,15 @@
 					self.__download_album(uri)
 
 		else:
-			parser.feed(result)
+			# hack around some weird chars that show up in the catalogue for some reason
+			result = result.replace("\x19", "'")
+			result = result.replace("\x13", "-")
+
+			try:
+				parser.feed(result)
+			except xml.sax.SAXParseException, e:
+				print "error parsing catalogue: %s" % e
+
 			self.__load_current_size += len(result)
 			self.__load_total_size = total
 



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