mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
add the store ebooksgratuits.com; add mimetypes epub, mobi and pdb(eReader)
This commit is contained in:
parent
015ed143be
commit
0780b49eac
Binary file not shown.
@ -40,6 +40,9 @@ def _init_mimetypes():
|
|||||||
global _mt_inited
|
global _mt_inited
|
||||||
import mimetypes
|
import mimetypes
|
||||||
mimetypes.init([P('mime.types')])
|
mimetypes.init([P('mime.types')])
|
||||||
|
mimetypes.add_type('application/epub+zip', '.epub')
|
||||||
|
mimetypes.add_type('application/x-mobipocket-ebook', '.mobi')
|
||||||
|
mimetypes.add_type('application/x-palmreader', '.pdb')
|
||||||
_mt_inited = True
|
_mt_inited = True
|
||||||
|
|
||||||
def guess_type(*args, **kwargs):
|
def guess_type(*args, **kwargs):
|
||||||
@ -54,6 +57,13 @@ def guess_all_extensions(*args, **kwargs):
|
|||||||
_init_mimetypes()
|
_init_mimetypes()
|
||||||
return mimetypes.guess_all_extensions(*args, **kwargs)
|
return mimetypes.guess_all_extensions(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def guess_extension(*args, **kwargs):
|
||||||
|
import mimetypes
|
||||||
|
if not _mt_inited:
|
||||||
|
_init_mimetypes()
|
||||||
|
return mimetypes.guess_extension(*args, **kwargs)
|
||||||
|
|
||||||
def get_types_map():
|
def get_types_map():
|
||||||
import mimetypes
|
import mimetypes
|
||||||
if not _mt_inited:
|
if not _mt_inited:
|
||||||
|
@ -1351,6 +1351,15 @@ class StoreEbookscomStore(StoreBase):
|
|||||||
formats = ['EPUB', 'LIT', 'MOBI', 'PDF']
|
formats = ['EPUB', 'LIT', 'MOBI', 'PDF']
|
||||||
affiliate = True
|
affiliate = True
|
||||||
|
|
||||||
|
class StoreEbooksGratuitsStore(StoreBase):
|
||||||
|
name = 'EbooksGratuits.com'
|
||||||
|
description = u''
|
||||||
|
actual_plugin = 'calibre.gui2.store.stores.ebooksgratuits_plugin:EbooksGratuitsStore'
|
||||||
|
|
||||||
|
headquarters = 'FR'
|
||||||
|
formats = ['EPUB', 'MOBI', 'PDF', 'PDB']
|
||||||
|
drm_free_only = True
|
||||||
|
|
||||||
# class StoreEBookShoppeUKStore(StoreBase):
|
# class StoreEBookShoppeUKStore(StoreBase):
|
||||||
# name = 'ebookShoppe UK'
|
# name = 'ebookShoppe UK'
|
||||||
# author = u'Charles Haley'
|
# author = u'Charles Haley'
|
||||||
@ -1644,6 +1653,7 @@ plugins += [
|
|||||||
StoreEbookNLStore,
|
StoreEbookNLStore,
|
||||||
StoreEbookpointStore,
|
StoreEbookpointStore,
|
||||||
StoreEbookscomStore,
|
StoreEbookscomStore,
|
||||||
|
StoreEbooksGratuitsStore,
|
||||||
StoreEHarlequinStore,
|
StoreEHarlequinStore,
|
||||||
StoreEKnigiStore,
|
StoreEKnigiStore,
|
||||||
StoreEscapeMagazineStore,
|
StoreEscapeMagazineStore,
|
||||||
|
@ -13,7 +13,7 @@ from lxml import etree
|
|||||||
|
|
||||||
from PyQt4.Qt import QUrl
|
from PyQt4.Qt import QUrl
|
||||||
|
|
||||||
from calibre import browser
|
from calibre import (browser, guess_extension)
|
||||||
from calibre.gui2 import open_url
|
from calibre.gui2 import open_url
|
||||||
from calibre.gui2.store import StorePlugin
|
from calibre.gui2.store import StorePlugin
|
||||||
from calibre.gui2.store.search_result import SearchResult
|
from calibre.gui2.store.search_result import SearchResult
|
||||||
@ -81,7 +81,7 @@ class OpenSearchOPDSStore(StorePlugin):
|
|||||||
s.detail_item = href
|
s.detail_item = href
|
||||||
elif 'http://opds-spec.org/acquisition' in rel:
|
elif 'http://opds-spec.org/acquisition' in rel:
|
||||||
if type:
|
if type:
|
||||||
ext = mimetypes.guess_extension(type)
|
ext = guess_extension(type)
|
||||||
if ext:
|
if ext:
|
||||||
ext = ext[1:].upper().strip()
|
ext = ext[1:].upper().strip()
|
||||||
s.downloads[ext] = href
|
s.downloads[ext] = href
|
||||||
|
Loading…
x
Reference in New Issue
Block a user