mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get Books: Add stores Chitanka and Bookoteka. Remove epubbuy.de at store's request
This commit is contained in:
commit
a0009c65ca
@ -1181,6 +1181,26 @@ class StoreBeWriteStore(StoreBase):
|
|||||||
headquarters = 'US'
|
headquarters = 'US'
|
||||||
formats = ['EPUB', 'MOBI', 'PDF']
|
formats = ['EPUB', 'MOBI', 'PDF']
|
||||||
|
|
||||||
|
class StoreBookotekaStore(StoreBase):
|
||||||
|
name = 'Bookoteka'
|
||||||
|
author = u'Tomasz Długosz'
|
||||||
|
description = u'E-booki w Bookotece dostępne są w formacie EPUB oraz PDF. Publikacje sprzedawane w Bookotece są objęte prawami autorskimi. Zobowiązaliśmy się chronić te prawa, ale bez ograniczania dostępu do książki użytkownikowi, który nabył ją w legalny sposób. Dlatego też Bookoteka stosuje tak zwany „watermarking transakcyjny” czyli swego rodzaju znaki wodne.'
|
||||||
|
actual_plugin = 'calibre.gui2.store.stores.bookoteka_plugin:BookotekaStore'
|
||||||
|
|
||||||
|
drm_free_only = True
|
||||||
|
headquarters = 'PL'
|
||||||
|
formats = ['EPUB', 'PDF']
|
||||||
|
|
||||||
|
class StoreChitankaStore(StoreBase):
|
||||||
|
name = u'Моята библиотека'
|
||||||
|
author = 'Alex Stanev'
|
||||||
|
description = u'Независим сайт за DRM свободна литература на български език'
|
||||||
|
actual_plugin = 'calibre.gui2.store.stores.chitanka_plugin:ChitankaStore'
|
||||||
|
|
||||||
|
drm_free_only = True
|
||||||
|
headquarters = 'BG'
|
||||||
|
formats = ['FB2', 'EPUB', 'TXT', 'SFB']
|
||||||
|
|
||||||
class StoreDieselEbooksStore(StoreBase):
|
class StoreDieselEbooksStore(StoreBase):
|
||||||
name = 'Diesel eBooks'
|
name = 'Diesel eBooks'
|
||||||
description = u'Instant access to over 2.4 million titles from hundreds of publishers including Harlequin, HarperCollins, John Wiley & Sons, McGraw-Hill, Simon & Schuster and Random House.'
|
description = u'Instant access to over 2.4 million titles from hundreds of publishers including Harlequin, HarperCollins, John Wiley & Sons, McGraw-Hill, Simon & Schuster and Random House.'
|
||||||
@ -1208,16 +1228,16 @@ class StoreEbookscomStore(StoreBase):
|
|||||||
formats = ['EPUB', 'LIT', 'MOBI', 'PDF']
|
formats = ['EPUB', 'LIT', 'MOBI', 'PDF']
|
||||||
affiliate = True
|
affiliate = True
|
||||||
|
|
||||||
class StoreEPubBuyDEStore(StoreBase):
|
#class StoreEPubBuyDEStore(StoreBase):
|
||||||
name = 'EPUBBuy DE'
|
# name = 'EPUBBuy DE'
|
||||||
author = 'Charles Haley'
|
# author = 'Charles Haley'
|
||||||
description = u'Bei EPUBBuy.com finden Sie ausschliesslich eBooks im weitverbreiteten EPUB-Format und ohne DRM. So haben Sie die freie Wahl, wo Sie Ihr eBook lesen: Tablet, eBook-Reader, Smartphone oder einfach auf Ihrem PC. So macht eBook-Lesen Spaß!'
|
# description = u'Bei EPUBBuy.com finden Sie ausschliesslich eBooks im weitverbreiteten EPUB-Format und ohne DRM. So haben Sie die freie Wahl, wo Sie Ihr eBook lesen: Tablet, eBook-Reader, Smartphone oder einfach auf Ihrem PC. So macht eBook-Lesen Spaß!'
|
||||||
actual_plugin = 'calibre.gui2.store.stores.epubbuy_de_plugin:EPubBuyDEStore'
|
# actual_plugin = 'calibre.gui2.store.stores.epubbuy_de_plugin:EPubBuyDEStore'
|
||||||
|
#
|
||||||
drm_free_only = True
|
# drm_free_only = True
|
||||||
headquarters = 'DE'
|
# headquarters = 'DE'
|
||||||
formats = ['EPUB']
|
# formats = ['EPUB']
|
||||||
affiliate = True
|
# affiliate = True
|
||||||
|
|
||||||
class StoreEBookShoppeUKStore(StoreBase):
|
class StoreEBookShoppeUKStore(StoreBase):
|
||||||
name = 'ebookShoppe UK'
|
name = 'ebookShoppe UK'
|
||||||
@ -1455,11 +1475,13 @@ plugins += [
|
|||||||
StoreBNStore,
|
StoreBNStore,
|
||||||
StoreBeamEBooksDEStore,
|
StoreBeamEBooksDEStore,
|
||||||
StoreBeWriteStore,
|
StoreBeWriteStore,
|
||||||
|
StoreBookotekaStore,
|
||||||
|
StoreChitankaStore,
|
||||||
StoreDieselEbooksStore,
|
StoreDieselEbooksStore,
|
||||||
StoreEbookNLStore,
|
StoreEbookNLStore,
|
||||||
StoreEbookscomStore,
|
StoreEbookscomStore,
|
||||||
StoreEBookShoppeUKStore,
|
StoreEBookShoppeUKStore,
|
||||||
StoreEPubBuyDEStore,
|
# StoreEPubBuyDEStore,
|
||||||
StoreEHarlequinStore,
|
StoreEHarlequinStore,
|
||||||
StoreEpubBudStore,
|
StoreEpubBudStore,
|
||||||
StoreFeedbooksStore,
|
StoreFeedbooksStore,
|
||||||
|
@ -4,3 +4,4 @@ or asked not to be included in the store integration.
|
|||||||
* Borders (http://www.borders.com/).
|
* Borders (http://www.borders.com/).
|
||||||
* Indigo (http://www.chapters.indigo.ca/).
|
* Indigo (http://www.chapters.indigo.ca/).
|
||||||
* Libraria Rizzoli (http://libreriarizzoli.corriere.it/).
|
* Libraria Rizzoli (http://libreriarizzoli.corriere.it/).
|
||||||
|
* EPubBuy DE: reason: too much traffic for too little sales
|
||||||
|
78
src/calibre/gui2/store/stores/bookoteka_plugin.py
Normal file
78
src/calibre/gui2/store/stores/bookoteka_plugin.py
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||||
|
|
||||||
|
__license__ = 'GPL 3'
|
||||||
|
__copyright__ = '2011, Tomasz Długosz <tomek3d@gmail.com>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
import re
|
||||||
|
import urllib
|
||||||
|
from contextlib import closing
|
||||||
|
|
||||||
|
from lxml import html
|
||||||
|
|
||||||
|
from PyQt4.Qt import QUrl
|
||||||
|
|
||||||
|
from calibre import browser, url_slash_cleaner
|
||||||
|
from calibre.gui2 import open_url
|
||||||
|
from calibre.gui2.store import StorePlugin
|
||||||
|
from calibre.gui2.store.basic_config import BasicStoreConfig
|
||||||
|
from calibre.gui2.store.search_result import SearchResult
|
||||||
|
from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
||||||
|
|
||||||
|
class BookotekaStore(BasicStoreConfig, StorePlugin):
|
||||||
|
|
||||||
|
def open(self, parent=None, detail_item=None, external=False):
|
||||||
|
|
||||||
|
url = 'http://bookoteka.pl/ebooki'
|
||||||
|
detail_url = None
|
||||||
|
|
||||||
|
if detail_item:
|
||||||
|
detail_url = detail_item
|
||||||
|
|
||||||
|
if external or self.config.get('open_external', False):
|
||||||
|
open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
|
||||||
|
else:
|
||||||
|
d = WebStoreDialog(self.gui, url, parent, detail_url)
|
||||||
|
d.setWindowTitle(self.name)
|
||||||
|
d.set_tags(self.config.get('tags', ''))
|
||||||
|
d.exec_()
|
||||||
|
|
||||||
|
def search(self, query, max_results=10, timeout=60):
|
||||||
|
url = 'http://bookoteka.pl/list?search=' + urllib.quote_plus(query) + '&cat=1&hp=1&type=1'
|
||||||
|
|
||||||
|
br = browser()
|
||||||
|
|
||||||
|
counter = max_results
|
||||||
|
with closing(br.open(url, timeout=timeout)) as f:
|
||||||
|
doc = html.fromstring(f.read())
|
||||||
|
for data in doc.xpath('//li[@class="EBOOK"]'):
|
||||||
|
if counter <= 0:
|
||||||
|
break
|
||||||
|
|
||||||
|
id = ''.join(data.xpath('.//a[@class="item_link"]/@href'))
|
||||||
|
if not id:
|
||||||
|
continue
|
||||||
|
|
||||||
|
cover_url = ''.join(data.xpath('.//a[@class="item_link"]/@style'))
|
||||||
|
cover_url = re.sub(r'.*\(', '', cover_url)
|
||||||
|
cover_url = re.sub(r'\).*', '', cover_url)
|
||||||
|
title = ''.join(data.xpath('.//div[@class="shelf_title"]/a/text()'))
|
||||||
|
author = ''.join(data.xpath('.//div[@class="shelf_authors"]/text()'))
|
||||||
|
price = ''.join(data.xpath('.//span[@class="EBOOK"]/text()'))
|
||||||
|
price = price.replace('.', ',')
|
||||||
|
formats = ', '.join(data.xpath('.//a[@class="fancybox protected"]/text()'))
|
||||||
|
|
||||||
|
counter -= 1
|
||||||
|
|
||||||
|
s = SearchResult()
|
||||||
|
s.cover_url = 'http://bookoteka.pl' + cover_url
|
||||||
|
s.title = title.strip()
|
||||||
|
s.author = author.strip()
|
||||||
|
s.price = price
|
||||||
|
s.detail_item = 'http://bookoteka.pl' + id.strip()
|
||||||
|
s.drm = SearchResult.DRM_UNLOCKED
|
||||||
|
s.formats = formats.strip()
|
||||||
|
|
||||||
|
yield s
|
140
src/calibre/gui2/store/stores/chitanka_plugin.py
Normal file
140
src/calibre/gui2/store/stores/chitanka_plugin.py
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||||
|
|
||||||
|
__license__ = 'GPL 3'
|
||||||
|
__copyright__ = '2011, Alex Stanev <alex@stanev.org>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
import re
|
||||||
|
import urllib
|
||||||
|
from contextlib import closing
|
||||||
|
|
||||||
|
from lxml import html
|
||||||
|
|
||||||
|
from PyQt4.Qt import QUrl
|
||||||
|
|
||||||
|
from calibre import browser, url_slash_cleaner
|
||||||
|
from calibre.gui2 import open_url
|
||||||
|
from calibre.gui2.store import StorePlugin
|
||||||
|
from calibre.gui2.store.basic_config import BasicStoreConfig
|
||||||
|
from calibre.gui2.store.search_result import SearchResult
|
||||||
|
from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
||||||
|
|
||||||
|
class ChitankaStore(BasicStoreConfig, StorePlugin):
|
||||||
|
|
||||||
|
def open(self, parent=None, detail_item=None, external=False):
|
||||||
|
url = 'http://chitanka.info'
|
||||||
|
|
||||||
|
if external or self.config.get('open_external', False):
|
||||||
|
if detail_item:
|
||||||
|
url = url + detail_item
|
||||||
|
open_url(QUrl(url_slash_cleaner(url)))
|
||||||
|
else:
|
||||||
|
detail_url = None
|
||||||
|
if detail_item:
|
||||||
|
detail_url = url + detail_item
|
||||||
|
d = WebStoreDialog(self.gui, url, parent, detail_url)
|
||||||
|
d.setWindowTitle(self.name)
|
||||||
|
d.set_tags(self.config.get('tags', ''))
|
||||||
|
d.exec_()
|
||||||
|
|
||||||
|
def search(self, query, max_results=10, timeout=60):
|
||||||
|
|
||||||
|
base_url = 'http://chitanka.info'
|
||||||
|
url = base_url + '/search?q=' + urllib.quote(query)
|
||||||
|
counter = max_results
|
||||||
|
|
||||||
|
# search for book title
|
||||||
|
br = browser()
|
||||||
|
with closing(br.open(url, timeout=timeout)) as f:
|
||||||
|
f = unicode(f.read(), 'utf-8')
|
||||||
|
doc = html.fromstring(f)
|
||||||
|
|
||||||
|
for data in doc.xpath('//ul[@class="superlist booklist"]/li'):
|
||||||
|
if counter <= 0:
|
||||||
|
break
|
||||||
|
|
||||||
|
id = ''.join(data.xpath('.//a[@class="booklink"]/@href'))
|
||||||
|
if not id:
|
||||||
|
continue
|
||||||
|
|
||||||
|
cover_url = ''.join(data.xpath('.//a[@class="booklink"]/img/@src'))
|
||||||
|
title = ''.join(data.xpath('.//a[@class="booklink"]/i/text()'))
|
||||||
|
author = ''.join(data.xpath('.//span[@class="bookauthor"]/a/text()'))
|
||||||
|
fb2 = ''.join(data.xpath('.//a[@class="dl dl-fb2"]/@href'))
|
||||||
|
epub = ''.join(data.xpath('.//a[@class="dl dl-epub"]/@href'))
|
||||||
|
txt = ''.join(data.xpath('.//a[@class="dl dl-txt"]/@href'))
|
||||||
|
|
||||||
|
# remove .zip extensions
|
||||||
|
if fb2.find('.zip') != -1:
|
||||||
|
fb2 = fb2[:fb2.find('.zip')]
|
||||||
|
if epub.find('.zip') != -1:
|
||||||
|
epub = epub[:epub.find('.zip')]
|
||||||
|
if txt.find('.zip') != -1:
|
||||||
|
txt = txt[:txt.find('.zip')]
|
||||||
|
|
||||||
|
counter -= 1
|
||||||
|
|
||||||
|
s = SearchResult()
|
||||||
|
s.cover_url = cover_url
|
||||||
|
s.title = title.strip()
|
||||||
|
s.author = author.strip()
|
||||||
|
s.detail_item = id.strip()
|
||||||
|
s.drm = SearchResult.DRM_UNLOCKED
|
||||||
|
s.downloads['FB2'] = base_url + fb2.strip()
|
||||||
|
s.downloads['EPUB'] = base_url + epub.strip()
|
||||||
|
s.downloads['TXT'] = base_url + txt.strip()
|
||||||
|
s.formats = 'FB2, EPUB, TXT, SFB'
|
||||||
|
yield s
|
||||||
|
|
||||||
|
# search for author names
|
||||||
|
for data in doc.xpath('//ul[@class="superlist"][1]/li'):
|
||||||
|
author_url = ''.join(data.xpath('.//a[contains(@href,"/person/")]/@href'))
|
||||||
|
if counter <= 0:
|
||||||
|
break
|
||||||
|
|
||||||
|
br2 = browser()
|
||||||
|
with closing(br2.open(base_url + author_url, timeout=timeout)) as f:
|
||||||
|
if counter <= 0:
|
||||||
|
break
|
||||||
|
f = unicode(f.read(), 'utf-8')
|
||||||
|
doc2 = html.fromstring(f)
|
||||||
|
|
||||||
|
# search for book title
|
||||||
|
for data in doc2.xpath('//ul[@class="superlist booklist"]/li'):
|
||||||
|
if counter <= 0:
|
||||||
|
break
|
||||||
|
|
||||||
|
id = ''.join(data.xpath('.//a[@class="booklink"]/@href'))
|
||||||
|
if not id:
|
||||||
|
continue
|
||||||
|
|
||||||
|
cover_url = ''.join(data.xpath('.//a[@class="booklink"]/img/@src'))
|
||||||
|
title = ''.join(data.xpath('.//a[@class="booklink"]/i/text()'))
|
||||||
|
author = ''.join(data.xpath('.//span[@class="bookauthor"]/a/text()'))
|
||||||
|
fb2 = ''.join(data.xpath('.//a[@class="dl dl-fb2"]/@href'))
|
||||||
|
epub = ''.join(data.xpath('.//a[@class="dl dl-epub"]/@href'))
|
||||||
|
txt = ''.join(data.xpath('.//a[@class="dl dl-txt"]/@href'))
|
||||||
|
|
||||||
|
# remove .zip extensions
|
||||||
|
if fb2.find('.zip') != -1:
|
||||||
|
fb2 = fb2[:fb2.find('.zip')]
|
||||||
|
if epub.find('.zip') != -1:
|
||||||
|
epub = epub[:epub.find('.zip')]
|
||||||
|
if txt.find('.zip') != -1:
|
||||||
|
txt = txt[:txt.find('.zip')]
|
||||||
|
|
||||||
|
counter -= 1
|
||||||
|
|
||||||
|
s = SearchResult()
|
||||||
|
s.cover_url = cover_url
|
||||||
|
s.title = title.strip()
|
||||||
|
s.author = author.strip()
|
||||||
|
s.detail_item = id.strip()
|
||||||
|
s.drm = SearchResult.DRM_UNLOCKED
|
||||||
|
s.downloads['FB2'] = base_url + fb2.strip()
|
||||||
|
s.downloads['EPUB'] = base_url + epub.strip()
|
||||||
|
s.downloads['TXT'] = base_url + txt.strip()
|
||||||
|
s.formats = 'FB2, EPUB, TXT, SFB'
|
||||||
|
yield s
|
Loading…
x
Reference in New Issue
Block a user