From 31030fe6fd962f9cfd1d817f52017c1972f06eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Sat, 24 Mar 2012 16:27:38 +0100 Subject: [PATCH 1/4] show MOBI as separate item, with correct DRM status --- src/calibre/gui2/store/stores/woblink_plugin.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/store/stores/woblink_plugin.py b/src/calibre/gui2/store/stores/woblink_plugin.py index f235169bbe..1217bd3566 100644 --- a/src/calibre/gui2/store/stores/woblink_plugin.py +++ b/src/calibre/gui2/store/stores/woblink_plugin.py @@ -82,11 +82,17 @@ class WoblinkStore(BasicStoreConfig, StorePlugin): s.detail_item = id.strip() # MOBI should be send first, if 'MOBI' in formats: - s.drm = SearchResult.DRM_UNLOCKED - s.formats = 'MOBI' + t = SearchResult() + t.cover_url = s.cover_url + t.title = s.title +' MOBI' + t.author = s.author + t.price = s.price + t.detail_item = s.detail_item + t.drm = SearchResult.DRM_UNLOCKED + t.formats = 'MOBI' formats.remove('MOBI') counter -= 1 - yield s + yield t # and the remaining formats (if any) next if formats: From fda1d71b7c24173a9c3109bd273ce96b18620d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Mon, 26 Mar 2012 22:54:21 +0200 Subject: [PATCH 2/4] Ebookpoint got rocketboosted when formats became visible on store's result page --- src/calibre/gui2/store/stores/ebookpoint_plugin.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/store/stores/ebookpoint_plugin.py b/src/calibre/gui2/store/stores/ebookpoint_plugin.py index 19b2e0a428..94e6cc73ca 100644 --- a/src/calibre/gui2/store/stores/ebookpoint_plugin.py +++ b/src/calibre/gui2/store/stores/ebookpoint_plugin.py @@ -3,7 +3,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL 3' -__copyright__ = '2011, Tomasz Długosz ' +__copyright__ = '2011-2012, Tomasz Długosz ' __docformat__ = 'restructuredtext en' import re @@ -64,9 +64,7 @@ class EbookpointStore(BasicStoreConfig, StorePlugin): author = ''.join(data.xpath('.//p[@class="author"]/text()')) price = ''.join(data.xpath('.//p[@class="price"]/ins/text()')) - with closing(br.open(id.strip(), timeout=timeout)) as nf: - idata = html.fromstring(nf.read()) - formats = ', '.join(idata.xpath('//dd[@class="radio-line"]/label/text()')) + formats = ', '.join(data.xpath('.//div[@class="ikony"]/span/text()')) counter -= 1 @@ -77,6 +75,6 @@ class EbookpointStore(BasicStoreConfig, StorePlugin): s.price = re.sub(r'\.',',',price) s.detail_item = id.strip() s.drm = SearchResult.DRM_UNLOCKED - s.formats = formats.upper().strip() + s.formats = formats.upper() yield s From 60d606910dd24dec238e80fe8359527693b72dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Tue, 27 Mar 2012 21:34:20 +0200 Subject: [PATCH 3/4] formats section rewritten --- .../gui2/store/stores/woblink_plugin.py | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/calibre/gui2/store/stores/woblink_plugin.py b/src/calibre/gui2/store/stores/woblink_plugin.py index 9f514bfe19..4f47ca9a07 100644 --- a/src/calibre/gui2/store/stores/woblink_plugin.py +++ b/src/calibre/gui2/store/stores/woblink_plugin.py @@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en' import re import urllib from contextlib import closing +import copy from lxml import html @@ -66,13 +67,6 @@ class WoblinkStore(BasicStoreConfig, StorePlugin): price = ''.join(data.xpath('.//div[@class="prices"]/span[1]/span/text()')) price = re.sub('\.', ',', price) formats = [ form[8:-4].split('_')[0] for form in data.xpath('.//p[3]/img/@src')] - if 'epub' in formats: - formats.remove('epub') - formats.append('WOBLINK') - if 'E Ink' in data.xpath('.//div[@class="prices"]/img/@title'): - formats.insert(0, 'EPUB') - if 'pdf' in formats: - formats[formats.index('pdf')] = 'PDF' s = SearchResult() s.cover_url = 'http://woblink.com' + cover_url @@ -83,12 +77,8 @@ class WoblinkStore(BasicStoreConfig, StorePlugin): # MOBI should be send first, if 'MOBI' in formats: - t = SearchResult() - t.cover_url = s.cover_url - t.title = s.title +' MOBI' - t.author = s.author - t.price = s.price - t.detail_item = s.detail_item + t = copy.copy(s) + t.title += ' MOBI' t.drm = SearchResult.DRM_UNLOCKED t.formats = 'MOBI' formats.remove('MOBI') @@ -98,15 +88,14 @@ class WoblinkStore(BasicStoreConfig, StorePlugin): # and the remaining formats (if any) next if formats: - s = SearchResult() - s.cover_url = 'http://woblink.com' + cover_url - s.title = title.strip() - s.author = author.strip() - s.price = price + ' zł' - s.detail_item = id.strip() + if 'epub' in formats: + formats.remove('epub') + formats.append('WOBLINK') + if 'E Ink' in data.xpath('.//div[@class="prices"]/img/@title'): + formats.insert(0, 'EPUB') s.drm = SearchResult.DRM_LOCKED - s.formats = ', '.join(formats) + s.formats = ', '.join(formats).upper() counter -= 1 yield s From d2263aef00ed409c790a621eaa1b6d4600b7ab9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82ugosz?= Date: Tue, 27 Mar 2012 23:36:22 +0200 Subject: [PATCH 4/4] MOBI spotted in nexto --- src/calibre/customize/builtins.py | 2 +- src/calibre/gui2/store/stores/nexto_plugin.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index 3e91bc2ef3..14e0a564db 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -1460,7 +1460,7 @@ class StoreNextoStore(StoreBase): actual_plugin = 'calibre.gui2.store.stores.nexto_plugin:NextoStore' headquarters = 'PL' - formats = ['EPUB', 'PDF'] + formats = ['EPUB', 'MOBI', 'PDF'] affiliate = True class StoreOpenBooksStore(StoreBase): diff --git a/src/calibre/gui2/store/stores/nexto_plugin.py b/src/calibre/gui2/store/stores/nexto_plugin.py index f7572e6522..79cb1be2f1 100644 --- a/src/calibre/gui2/store/stores/nexto_plugin.py +++ b/src/calibre/gui2/store/stores/nexto_plugin.py @@ -68,8 +68,8 @@ class NextoStore(BasicStoreConfig, StorePlugin): title = ''.join(data.xpath('.//a[@class="title"]/text()')) title = re.sub(r' - ebook$', '', title) formats = ', '.join(data.xpath('.//ul[@class="formats_available"]/li//b/text()')) - DrmFree = re.search(r'bez.DRM', formats) - formats = re.sub(r'\(.+\)', '', formats) + DrmFree = re.search(r'znak', formats) + formats = re.sub(r'\ ?\(.+?\)', '', formats) author = '' with closing(br.open('http://www.nexto.pl/' + id.strip(), timeout=timeout/4)) as nf: