summaryrefslogtreecommitdiff
path: root/nephilim/plugins
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-03-02 21:37:30 +0100
committerAnton Khirnov <wyskas@gmail.com>2009-03-02 21:37:30 +0100
commitc3817faba8228f13e57b599799296be6647b9331 (patch)
treef74165b1b30ef42af8db432e3be0183004416d8d /nephilim/plugins
parent824ef764cedada1812caf42f7f182b016eed0d9a (diff)
AlbumCover: fix amazon+unicode songs.
Diffstat (limited to 'nephilim/plugins')
-rw-r--r--nephilim/plugins/AlbumCover.py28
1 files changed, 14 insertions, 14 deletions
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"<DetailPageURL>([^<]+)</DetailPageURL>")
+ url_re = re.compile(r'<DetailPageURL>([^<]+)</DetailPageURL>')
m = url_re.search(xmldata)
return m and m.group(1)