add the store ebooksgratuits.com; add mimetypes epub, mobi and pdb(eReader)

This commit is contained in:
Florent FAYOLLE 2012-08-15 20:39:28 +02:00
parent 015ed143be
commit 0780b49eac
4 changed files with 22 additions and 2 deletions

Binary file not shown.

View File

@ -40,6 +40,9 @@ def _init_mimetypes():
global _mt_inited
import mimetypes
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
def guess_type(*args, **kwargs):
@ -54,6 +57,13 @@ def guess_all_extensions(*args, **kwargs):
_init_mimetypes()
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():
import mimetypes
if not _mt_inited:

View File

@ -1351,6 +1351,15 @@ class StoreEbookscomStore(StoreBase):
formats = ['EPUB', 'LIT', 'MOBI', 'PDF']
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):
# name = 'ebookShoppe UK'
# author = u'Charles Haley'
@ -1644,6 +1653,7 @@ plugins += [
StoreEbookNLStore,
StoreEbookpointStore,
StoreEbookscomStore,
StoreEbooksGratuitsStore,
StoreEHarlequinStore,
StoreEKnigiStore,
StoreEscapeMagazineStore,

View File

@ -13,7 +13,7 @@ from lxml import etree
from PyQt4.Qt import QUrl
from calibre import browser
from calibre import (browser, guess_extension)
from calibre.gui2 import open_url
from calibre.gui2.store import StorePlugin
from calibre.gui2.store.search_result import SearchResult
@ -81,7 +81,7 @@ class OpenSearchOPDSStore(StorePlugin):
s.detail_item = href
elif 'http://opds-spec.org/acquisition' in rel:
if type:
ext = mimetypes.guess_extension(type)
ext = guess_extension(type)
if ext:
ext = ext[1:].upper().strip()
s.downloads[ext] = href