mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
version 0.4.105
This commit is contained in:
parent
f30e2cc510
commit
e9f43e5801
@ -2,7 +2,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
__appname__ = 'calibre'
|
__appname__ = 'calibre'
|
||||||
__version__ = '0.4.104'
|
__version__ = '0.4.105'
|
||||||
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
||||||
'''
|
'''
|
||||||
Various run time constants.
|
Various run time constants.
|
||||||
|
@ -20,7 +20,11 @@ from calibre.ebooks.metadata.opf2 import OPF
|
|||||||
from calibre.ebooks.metadata.rtf import set_metadata as set_rtf_metadata
|
from calibre.ebooks.metadata.rtf import set_metadata as set_rtf_metadata
|
||||||
from calibre.ebooks.lrf.meta import set_metadata as set_lrf_metadata
|
from calibre.ebooks.lrf.meta import set_metadata as set_lrf_metadata
|
||||||
from calibre.ebooks.metadata.epub import set_metadata as set_epub_metadata
|
from calibre.ebooks.metadata.epub import set_metadata as set_epub_metadata
|
||||||
from calibre.libunrar import extract_member as rar_extract_first
|
try:
|
||||||
|
from calibre.libunrar import extract_member as rar_extract_first
|
||||||
|
except OSError:
|
||||||
|
rar_extract_first = None
|
||||||
|
|
||||||
from calibre.libunzip import extract_member as zip_extract_first
|
from calibre.libunzip import extract_member as zip_extract_first
|
||||||
|
|
||||||
from calibre.ebooks.metadata import MetaInformation
|
from calibre.ebooks.metadata import MetaInformation
|
||||||
|
@ -123,6 +123,9 @@ class BookHeader(object):
|
|||||||
class MobiReader(object):
|
class MobiReader(object):
|
||||||
|
|
||||||
PAGE_BREAK_PAT = re.compile(r'(<[/]{0,1}mbp:pagebreak\s*[/]{0,1}>)+', re.IGNORECASE)
|
PAGE_BREAK_PAT = re.compile(r'(<[/]{0,1}mbp:pagebreak\s*[/]{0,1}>)+', re.IGNORECASE)
|
||||||
|
IMAGE_PATS = map(re.compile, (r'\shirecindex=[\'"]{0,1}(\d+)[\'"]{0,1}',
|
||||||
|
r'\srecindex=[\'"]{0,1}(\d+)[\'"]{0,1}',
|
||||||
|
r'\slorecindex=[\'"]{0,1}(\d+)[\'"]{0,1}'))
|
||||||
|
|
||||||
def __init__(self, filename_or_stream, verbose=False):
|
def __init__(self, filename_or_stream, verbose=False):
|
||||||
self.verbose = verbose
|
self.verbose = verbose
|
||||||
@ -405,10 +408,7 @@ class MobiReader(object):
|
|||||||
|
|
||||||
def fix_images(match):
|
def fix_images(match):
|
||||||
tag = match.group()
|
tag = match.group()
|
||||||
for pat in (r'\shirecindex=[\'"]{0,1}(\d+)[\'"]{0,1}',
|
for pat in self.IMAGE_PATS:
|
||||||
'\srecindex=[\'"]{0,1}(\d+)[\'"]{0,1}',
|
|
||||||
'\slorecindex=[\'"]{0,1}(\d+)[\'"]{0,1}'):
|
|
||||||
pat = re.compile(pat)
|
|
||||||
m = pat.search(tag)
|
m = pat.search(tag)
|
||||||
if m:
|
if m:
|
||||||
return pat.sub(' src="images/%s.jpg"'%m.group(1), tag)
|
return pat.sub(' src="images/%s.jpg"'%m.group(1), tag)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user