[rhythmbox] coverart: use secondary images from discogs if no primary image found
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] coverart: use secondary images from discogs if no primary image found
- Date: Sun, 10 Jan 2010 00:44:56 +0000 (UTC)
commit 8df7bea126ba768812ba6f8712319355ad4c4859
Author: Jabik Postmus <jabik snth eu>
Date: Sun Jan 10 10:43:20 2010 +1000
coverart: use secondary images from discogs if no primary image found
.../artdisplay/artdisplay/DiscogsCoverArtSearch.py | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/plugins/artdisplay/artdisplay/DiscogsCoverArtSearch.py b/plugins/artdisplay/artdisplay/DiscogsCoverArtSearch.py
index 07cfddd..d534ca3 100644
--- a/plugins/artdisplay/artdisplay/DiscogsCoverArtSearch.py
+++ b/plugins/artdisplay/artdisplay/DiscogsCoverArtSearch.py
@@ -212,18 +212,25 @@ class DiscogsCoverArtSearch (object):
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]