From 79f2d3bd4daa305eeca3132627a633d18a8ae25f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 21 Apr 2011 19:32:11 -0600 Subject: [PATCH] Bettwe cover thumbnails for the Amazon store plugin --- src/calibre/gui2/store/amazon_plugin.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/store/amazon_plugin.py b/src/calibre/gui2/store/amazon_plugin.py index d5d8b54600..a68e4611f0 100644 --- a/src/calibre/gui2/store/amazon_plugin.py +++ b/src/calibre/gui2/store/amazon_plugin.py @@ -154,6 +154,13 @@ class AmazonKindleStore(StorePlugin): cover_img = data.xpath('//div[@class="productImage"]/a[@href="%s"]/img/@src' % asin_href) if cover_img: cover_url = cover_img[0] + parts = cover_url.split('/') + bn = parts[-1] + f, _, ext = bn.rpartition('.') + if '_' in f: + bn = f.partition('_')[0]+'_SL160_.'+ext + parts[-1] = bn + cover_url = '/'.join(parts) title = ''.join(data.xpath('div[@class="productTitle"]/a/text()')) author = ''.join(data.xpath('div[@class="productTitle"]/span[@class="ptBrand"]/text()')) @@ -174,7 +181,7 @@ class AmazonKindleStore(StorePlugin): def get_details(self, search_result, timeout): url = 'http://amazon.com/dp/' - + br = browser() with closing(br.open(url + search_result.detail_item, timeout=timeout)) as nf: idata = html.fromstring(nf.read()) @@ -187,4 +194,4 @@ class AmazonKindleStore(StorePlugin): search_result.drm = SearchResult.DRM_LOCKED return True - \ No newline at end of file +