def convert(self, oeb, output_path, input_plugin, opts, log): self.log, self.opts, self.oeb = log, opts, oeb lrf_opts = LRFOptions(output_path, opts, oeb) if input_plugin.is_image_collection: self.convert_images(input_plugin.get_images(), lrf_opts, 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 oeb_output = plugin_for_output_format('oeb') oeb_output.convert(oeb, tdir, input_plugin, opts, log) opf = [x for x in os.listdir(tdir) if x.endswith('.opf')][0] from calibre.ebooks.lrf.html.convert_from import process_file process_file(os.path.join(tdir, opf), lrf_opts, self.log)
def convert(self, oeb, output_path, input_plugin, opts, log): self.log, self.opts, self.oeb = log, opts, oeb lrf_opts = LRFOptions(output_path, opts, oeb) if input_plugin.is_image_collection: self.convert_images(input_plugin.get_images(), lrf_opts, 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 oeb_output = plugin_for_output_format('oeb') oeb_output.convert(oeb, tdir, input_plugin, opts, log) opf = [x for x in os.listdir(tdir) if x.endswith('.opf')][0] from calibre.ebooks.lrf.html.convert_from import process_file process_file(os.path.join(tdir, opf), lrf_opts, self.log)