From c9800add54e58d2fc03b362dde8f228743a437a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Thu, 15 Dec 2011 21:56:43 +0100 Subject: [PATCH 1/3] improve format detection for Gandalf store --- src/calibre/gui2/store/stores/gandalf_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/store/stores/gandalf_plugin.py b/src/calibre/gui2/store/stores/gandalf_plugin.py index 5e3c37e11b..55da64ba18 100644 --- a/src/calibre/gui2/store/stores/gandalf_plugin.py +++ b/src/calibre/gui2/store/stores/gandalf_plugin.py @@ -56,8 +56,8 @@ class GandalfStore(BasicStoreConfig, StorePlugin): cover_url = ''.join(data.xpath('.//img/@src')) title = ''.join(data.xpath('.//div[@class="info"]/h3/a/@title')) - formats = title.split() - formats = formats[-1] + formats = ''.join(data.xpath('.//div[@class="info"]/p[1]/text()')) + formats = re.findall(r'\((.*?)\)',formats)[0] author = ''.join(data.xpath('.//div[@class="info"]/h4/text() | .//div[@class="info"]/h4/span/text()')) price = ''.join(data.xpath('.//h3[@class="promocja"]/text()')) price = re.sub('PLN', 'zł', price) From bac2e3ce6ca6a829d4a0c2a6dd16e45361b668f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Thu, 15 Dec 2011 22:07:02 +0100 Subject: [PATCH 2/3] fix finding cover URL --- src/calibre/gui2/store/stores/gandalf_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/store/stores/gandalf_plugin.py b/src/calibre/gui2/store/stores/gandalf_plugin.py index 55da64ba18..01a1134147 100644 --- a/src/calibre/gui2/store/stores/gandalf_plugin.py +++ b/src/calibre/gui2/store/stores/gandalf_plugin.py @@ -54,7 +54,7 @@ class GandalfStore(BasicStoreConfig, StorePlugin): if not id: continue - cover_url = ''.join(data.xpath('.//img/@src')) + cover_url = ''.join(data.xpath('.//div[@class="info"]/h3/a/@id')) title = ''.join(data.xpath('.//div[@class="info"]/h3/a/@title')) formats = ''.join(data.xpath('.//div[@class="info"]/p[1]/text()')) formats = re.findall(r'\((.*?)\)',formats)[0] @@ -67,7 +67,7 @@ class GandalfStore(BasicStoreConfig, StorePlugin): counter -= 1 s = SearchResult() - s.cover_url = cover_url + s.cover_url = 'http://imguser.gandalf.com.pl/' + re.sub('p', 'p_', cover_url) + '.jpg' s.title = title.strip() s.author = author.strip() s.price = price From 09c192452b3acb827bba9e9cbe8a466573fa82c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Thu, 15 Dec 2011 22:15:23 +0100 Subject: [PATCH 3/3] fix price detection --- src/calibre/gui2/store/stores/gandalf_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/store/stores/gandalf_plugin.py b/src/calibre/gui2/store/stores/gandalf_plugin.py index 01a1134147..e206be72d3 100644 --- a/src/calibre/gui2/store/stores/gandalf_plugin.py +++ b/src/calibre/gui2/store/stores/gandalf_plugin.py @@ -59,7 +59,7 @@ class GandalfStore(BasicStoreConfig, StorePlugin): formats = ''.join(data.xpath('.//div[@class="info"]/p[1]/text()')) formats = re.findall(r'\((.*?)\)',formats)[0] author = ''.join(data.xpath('.//div[@class="info"]/h4/text() | .//div[@class="info"]/h4/span/text()')) - price = ''.join(data.xpath('.//h3[@class="promocja"]/text()')) + price = ''.join(data.xpath('.//div[@class="options"]/h3/text()')) price = re.sub('PLN', 'zł', price) price = re.sub('\.', ',', price) drm = data.xpath('boolean(.//div[@class="info" and contains(., "Zabezpieczenie: DRM")])')