mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
75330d6fd9
commit
ba52a1d2bf
@ -19,7 +19,7 @@ from calibre.ebooks.mobi.reader.mobi8 import Mobi8Reader
|
|||||||
from calibre.ebooks.conversion.plumber import Plumber, create_oebbook
|
from calibre.ebooks.conversion.plumber import Plumber, create_oebbook
|
||||||
from calibre.customize.ui import (plugin_for_input_format,
|
from calibre.customize.ui import (plugin_for_input_format,
|
||||||
plugin_for_output_format)
|
plugin_for_output_format)
|
||||||
from calibre.utils.ipc.simple_worker import fork_job
|
from calibre.utils.ipc.simple_worker import fork_job
|
||||||
|
|
||||||
class BadFormat(ValueError):
|
class BadFormat(ValueError):
|
||||||
pass
|
pass
|
||||||
@ -72,7 +72,8 @@ def explode(path, dest, question=lambda x:True):
|
|||||||
dest), no_output=True)['result']
|
dest), no_output=True)['result']
|
||||||
|
|
||||||
def set_cover(oeb):
|
def set_cover(oeb):
|
||||||
if 'cover' not in oeb.guide or oeb.metadata['cover']: return
|
if 'cover' not in oeb.guide or oeb.metadata['cover']:
|
||||||
|
return
|
||||||
cover = oeb.guide['cover']
|
cover = oeb.guide['cover']
|
||||||
if cover.href in oeb.manifest.hrefs:
|
if cover.href in oeb.manifest.hrefs:
|
||||||
item = oeb.manifest.hrefs[cover.href]
|
item = oeb.manifest.hrefs[cover.href]
|
||||||
@ -95,8 +96,9 @@ def rebuild(src_dir, dest_path):
|
|||||||
if not opf:
|
if not opf:
|
||||||
raise ValueError('No OPF file found in %s'%src_dir)
|
raise ValueError('No OPF file found in %s'%src_dir)
|
||||||
opf = opf[0]
|
opf = opf[0]
|
||||||
# For debugging, uncomment the following line
|
# For debugging, uncomment the following two lines
|
||||||
# def fork_job(a, b, args=None, no_output=True): do_rebuild(*args)
|
# def fork_job(a, b, args=None, no_output=True):
|
||||||
|
# do_rebuild(*args)
|
||||||
fork_job('calibre.ebooks.mobi.tweak', 'do_rebuild', args=(opf, dest_path),
|
fork_job('calibre.ebooks.mobi.tweak', 'do_rebuild', args=(opf, dest_path),
|
||||||
no_output=True)
|
no_output=True)
|
||||||
|
|
||||||
|
@ -69,7 +69,8 @@ class Resources(object):
|
|||||||
cover_href = item.href
|
cover_href = item.href
|
||||||
|
|
||||||
for item in self.oeb.manifest.values():
|
for item in self.oeb.manifest.values():
|
||||||
if item.media_type not in OEB_RASTER_IMAGES: continue
|
if item.media_type not in OEB_RASTER_IMAGES:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
data = self.process_image(item.data)
|
data = self.process_image(item.data)
|
||||||
except:
|
except:
|
||||||
@ -116,8 +117,8 @@ class Resources(object):
|
|||||||
Add any images that were created after the call to add_resources()
|
Add any images that were created after the call to add_resources()
|
||||||
'''
|
'''
|
||||||
for item in self.oeb.manifest.values():
|
for item in self.oeb.manifest.values():
|
||||||
if (item.media_type not in OEB_RASTER_IMAGES or item.href in
|
if (item.media_type not in OEB_RASTER_IMAGES or item.href in self.item_map):
|
||||||
self.item_map): continue
|
continue
|
||||||
try:
|
try:
|
||||||
data = self.process_image(item.data)
|
data = self.process_image(item.data)
|
||||||
except:
|
except:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user