mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #3061 (TOC not created converting from FB2)
This commit is contained in:
parent
cbb1407bd0
commit
31d46786e5
@ -158,6 +158,13 @@ class LRFOutput(OutputFormatPlugin):
|
||||
|
||||
book.renderLrf(open(opts.output, 'wb'))
|
||||
|
||||
def flatten_toc(self):
|
||||
from calibre.ebooks.oeb.base import TOC
|
||||
nroot = TOC()
|
||||
for x in self.oeb.toc.iterdescendants():
|
||||
nroot.add(x.title, x.href)
|
||||
self.oeb.toc = nroot
|
||||
|
||||
|
||||
def convert(self, oeb, output_path, input_plugin, opts, log):
|
||||
self.log, self.opts, self.oeb = log, opts, oeb
|
||||
@ -169,6 +176,8 @@ class LRFOutput(OutputFormatPlugin):
|
||||
getattr(opts, 'wide', False))
|
||||
return
|
||||
|
||||
self.flatten_toc()
|
||||
|
||||
from calibre.ptempfile import TemporaryDirectory
|
||||
with TemporaryDirectory('_lrf_output') as tdir:
|
||||
from calibre.customize.ui import plugin_for_output_format
|
||||
|
@ -134,7 +134,6 @@ class Adder(QObject):
|
||||
mi.title = os.path.splitext(name)[0]
|
||||
mi.title = mi.title if isinstance(mi.title, unicode) else \
|
||||
mi.title.decode(preferred_encoding, 'replace')
|
||||
self.pd.set_msg(_('Added')+' '+mi.title)
|
||||
|
||||
if self.db is not None:
|
||||
if cover:
|
||||
@ -153,6 +152,9 @@ class Adder(QObject):
|
||||
'cover':None,
|
||||
'tags':mi.tags if mi.tags else []})
|
||||
|
||||
self.pd.set_msg(_('Added')+' '+mi.title)
|
||||
|
||||
|
||||
def process_duplicates(self):
|
||||
if not self.duplicates:
|
||||
return
|
||||
|
@ -54,6 +54,8 @@ def get_metadata(stream, cover=True):
|
||||
|
||||
if cdata is not None:
|
||||
mi.cover_data = ('jpg', cdata)
|
||||
del doc
|
||||
del raw
|
||||
return mi
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user