version 0.4.105

This commit is contained in:
Kovid Goyal 2008-11-13 18:29:42 -08:00
parent f30e2cc510
commit e9f43e5801
3 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,7 @@ __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
__appname__ = 'calibre'
__version__ = '0.4.104'
__version__ = '0.4.105'
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
'''
Various run time constants.

View File

@ -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.lrf.meta import set_metadata as set_lrf_metadata
from calibre.ebooks.metadata.epub import set_metadata as set_epub_metadata
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.ebooks.metadata import MetaInformation

View File

@ -123,6 +123,9 @@ class BookHeader(object):
class MobiReader(object):
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):
self.verbose = verbose
@ -405,10 +408,7 @@ class MobiReader(object):
def fix_images(match):
tag = match.group()
for pat in (r'\shirecindex=[\'"]{0,1}(\d+)[\'"]{0,1}',
'\srecindex=[\'"]{0,1}(\d+)[\'"]{0,1}',
'\slorecindex=[\'"]{0,1}(\d+)[\'"]{0,1}'):
pat = re.compile(pat)
for pat in self.IMAGE_PATS:
m = pat.search(tag)
if m:
return pat.sub(' src="images/%s.jpg"'%m.group(1), tag)