Get Books: Updates to Nexto, Ebookpoint and Woblink stores

This commit is contained in:
Kovid Goyal 2012-03-28 09:14:18 +05:30
commit 41a236f642
4 changed files with 18 additions and 32 deletions

View File

@ -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):

View File

@ -3,7 +3,7 @@
from __future__ import (unicode_literals, division, absolute_import, print_function)
__license__ = 'GPL 3'
__copyright__ = '2011, Tomasz Długosz <tomek3d@gmail.com>'
__copyright__ = '2011-2012, Tomasz Długosz <tomek3d@gmail.com>'
__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

View File

@ -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:

View File

@ -6,6 +6,7 @@ __license__ = 'GPL 3'
__copyright__ = '2011-2012, Tomasz Długosz <tomek3d@gmail.com>'
__docformat__ = 'restructuredtext en'
import copy
import re
import urllib
from contextlib import closing
@ -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,31 +77,25 @@ class WoblinkStore(BasicStoreConfig, StorePlugin):
# MOBI should be send first,
if 'MOBI' in formats:
s = SearchResult()
s.cover_url = 'http://woblink.com' + cover_url
s.title = title.strip()
s.author = author.strip()
s.price = price + ''
s.detail_item = id.strip()
s.drm = SearchResult.DRM_UNLOCKED
s.formats = 'MOBI'
t = copy.copy(s)
t.title += ' MOBI'
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:
s = SearchResult()
s.cover_url = 'http://woblink.com' + cover_url
s.title = title.strip()
s.author = author.strip()
s.price = price + ''
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