From 505e72035ffda5dc77bef4e662cef489191f5335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Wed, 28 Nov 2012 21:54:16 +0100 Subject: [PATCH 1/3] add series info to title, speed up author and price handling --- src/calibre/gui2/store/stores/publio_plugin.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/store/stores/publio_plugin.py b/src/calibre/gui2/store/stores/publio_plugin.py index fbf6d0c550..fe58fed03e 100644 --- a/src/calibre/gui2/store/stores/publio_plugin.py +++ b/src/calibre/gui2/store/stores/publio_plugin.py @@ -53,10 +53,15 @@ class PublioStore(BasicStoreConfig, StorePlugin): continue cover_url = ''.join(data.xpath('.//div[@class="img"]/a/img/@data-original')) + # TODO: fix highlight handling title = ''.join(data.xpath('.//div[@class="desc"]/h4/a/text()')) title2 = ''.join(data.xpath('.//div[@class="desc"]/h5/a/text()')) if title2: title = title + '. ' + title2 + if (''.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[last()]/span/text()')).strip() == "Seria:"): + # TODO: fix highlight handling + series = ''.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[last()]/a/@title')) + title = title + ' (seria ' + series + ')' author = ', '.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[@class="row"][1]/a/@title')) price = ''.join(data.xpath('.//div[@class="priceBoxContener "]/div/ins/text()')) if not price: @@ -68,8 +73,8 @@ class PublioStore(BasicStoreConfig, StorePlugin): s = SearchResult() s.cover_url = 'http://www.publio.pl' + cover_url s.title = title.strip() - s.author = author.strip() - s.price = price.strip() + s.author = author + s.price = price s.detail_item = 'http://www.publio.pl' + id.strip() s.drm = SearchResult.DRM_LOCKED if 'DRM' in formats else SearchResult.DRM_UNLOCKED s.formats = formats.replace(' DRM','').strip() From f21f73dbfa94274dbec2257cf5171a12dd2bda4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Wed, 28 Nov 2012 22:20:03 +0100 Subject: [PATCH 2/3] no need for re module --- src/calibre/gui2/store/stores/publio_plugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/calibre/gui2/store/stores/publio_plugin.py b/src/calibre/gui2/store/stores/publio_plugin.py index fe58fed03e..c732d2b9ca 100644 --- a/src/calibre/gui2/store/stores/publio_plugin.py +++ b/src/calibre/gui2/store/stores/publio_plugin.py @@ -6,7 +6,6 @@ __license__ = 'GPL 3' __copyright__ = '2012, Tomasz Długosz ' __docformat__ = 'restructuredtext en' -import re import urllib from contextlib import closing From 490c3cc56f5d95c138d7527e1a6aad622c4d0314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Thu, 29 Nov 2012 22:20:35 +0100 Subject: [PATCH 3/3] fix title detection --- src/calibre/gui2/store/stores/publio_plugin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/store/stores/publio_plugin.py b/src/calibre/gui2/store/stores/publio_plugin.py index c732d2b9ca..74eaf7bc7e 100644 --- a/src/calibre/gui2/store/stores/publio_plugin.py +++ b/src/calibre/gui2/store/stores/publio_plugin.py @@ -52,13 +52,11 @@ class PublioStore(BasicStoreConfig, StorePlugin): continue cover_url = ''.join(data.xpath('.//div[@class="img"]/a/img/@data-original')) - # TODO: fix highlight handling - title = ''.join(data.xpath('.//div[@class="desc"]/h4/a/text()')) - title2 = ''.join(data.xpath('.//div[@class="desc"]/h5/a/text()')) + title = ''.join(data.xpath('.//div[@class="img"]/a/@title')) + title2 = ''.join(data.xpath('.//div[@class="desc"]/h5//text()')) if title2: title = title + '. ' + title2 if (''.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[last()]/span/text()')).strip() == "Seria:"): - # TODO: fix highlight handling series = ''.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[last()]/a/@title')) title = title + ' (seria ' + series + ')' author = ', '.join(data.xpath('./div[@class="desc"]/div[@class="detailShortList"]/div[@class="row"][1]/a/@title'))