From c3817faba8228f13e57b599799296be6647b9331 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 2 Mar 2009 21:37:30 +0100 Subject: AlbumCover: fix amazon+unicode songs. --- nephilim/plugins/AlbumCover.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'nephilim/plugins') diff --git a/nephilim/plugins/AlbumCover.py b/nephilim/plugins/AlbumCover.py index 55e93e8..6ec62b3 100644 --- a/nephilim/plugins/AlbumCover.py +++ b/nephilim/plugins/AlbumCover.py @@ -271,10 +271,10 @@ import urllib AMAZON_AWS_ID = "0K4RZZKHSB5N2XYJWF02" class AmazonAlbumImage(object): - awsurl = "http://ecs.amazonaws.com/onca/xml" + awsurl = 'http://ecs.amazonaws.com/onca/xml' def __init__(self, artist, album): self.artist = artist - self.album = album + self.album = album def fetch(self): url = self._GetResultURL(self._SearchAmazon()) @@ -284,7 +284,7 @@ class AmazonAlbumImage(object): try: prod_data = urllib.urlopen(url).read() except: - self.important("timeout opening %s"%(url)) + logging.warning('timeout opening %s'%(url)) return None m = img_re.search(prod_data) if not m: @@ -294,25 +294,25 @@ class AmazonAlbumImage(object): def _SearchAmazon(self): data = { - "Service": "AWSECommerceService", - "Version": "2005-03-23", - "Operation": "ItemSearch", - "ContentType": "text/xml", - "SubscriptionId": AMAZON_AWS_ID, - "SearchIndex": "Music", - "ResponseGroup": "Small", + 'Service' : 'AWSECommerceService', + 'Version' : '2005-03-23', + 'Operation' : 'ItemSearch', + 'ContentType' : 'text/xml', + 'SubscriptionId': AMAZON_AWS_ID, + 'SearchIndex' : 'Music', + 'ResponseGroup' : 'Small', } - data["Artist"] = self.artist - data["Keywords"] = self.album + data['Artist'] = self.artist.encode('utf-8') + data['Keywords'] = self.album.encode('utf-8') - fd = urllib.urlopen("%s?%s" % (self.awsurl, urllib.urlencode(data))) + fd = urllib.urlopen('%s?%s' % (self.awsurl, urllib.urlencode(data))) return fd.read() def _GetResultURL(self, xmldata): if not xmldata: return None - url_re = re.compile(r"([^<]+)") + url_re = re.compile(r'([^<]+)') m = url_re.search(xmldata) return m and m.group(1) -- cgit v1.2.3