[Rhythmbox-devel] Patch for DiscogsCoverArtSearch.py



Hi all,

As disconcerned as I was that DiscogsCoverArtSearch plugin didn't seem
to fetch all the cover arts I tried to fix it. What I found was that the
script discards all the secondary cover art images, but there are quit a
lot albums at Discogs that have only secondary cover arts.
So I modified the script a bit to also include secondary cover art (only
when there is no primary cover art).

Could you please take a look at the patchfile I included with this
e-mail.
I have no clue where to turn to but to this mailing-list.

Thanks in advance.

With kind regards,

Jabik Postmus
<jabik snth eu>

-- 
If a 'train station' is where a train stops, what's a 'workstation'?
ESC:wq
--- DiscogsCoverArtSearch.py.bak	2010-01-09 22:36:04.000000000 +0100
+++ DiscogsCoverArtSearch.py	2010-01-10 00:20:59.000000000 +0100
@@ -212,18 +212,25 @@
 			self.callback (self, self.entry, [], *self.callback_args)
 			return
 
-		# find image URLs.  don't think there's much point using secondary images.
+		# find image URLs. 
+		# We could use secondary images, when there is no primary available.
+		# When there is a primary image, we must use that one, else the first
+		# secondary image.
 		image_urls = []
 		for tag in parsed.getElementsByTagName('image'):
 			type = tag.attributes['type'].value
-			if type != 'primary':
-				continue
 
 			url = tag.attributes['uri'].value
 			url.strip()
 			if url != "":
-				print "found image url: %s" % url
-				image_urls.append(url)
+				print "found %s image url: %s" % (type, url)
+				if type == 'primary':
+					# Put the primary image at the beginning of the list.
+					# The first in the list gets downloaded. 
+					image_urls.insert(0,url)
+				else:
+					# Add the secondary images at the end of the list.
+					image_urls.append(url)
 
 		self.callback (self, self.entry, [image_urls], *self.callback_args)
 


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