mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-04 09:43:02 +02:00
TCR, PDB (PalmDoc, zTXT) Input: Call TXT plugin while setting default values for options that are not set by calling plugin.
This commit is contained in:
parent
d23ce51b98
commit
3bb40c9911
3 changed files with 24 additions and 5 deletions
|
|
@ -62,7 +62,13 @@ def extract_content(self, output_dir):
|
|||
|
||||
self.log.info('Converting text to OEB...')
|
||||
stream = StringIO(raw_txt)
|
||||
|
||||
from calibre.customize.ui import plugin_for_input_format
|
||||
|
||||
txt_plugin = plugin_for_input_format('txt')
|
||||
for option in txt_plugin.options:
|
||||
if not hasattr(self.options, option.option.name):
|
||||
setattr(self.options, option.name, option.recommend_val)
|
||||
|
||||
stream.seek(0)
|
||||
return plugin_for_input_format('txt').convert(stream, self.options,
|
||||
'txt', self.log, {})
|
||||
return txt_plugin.convert(stream, self.options, 'txt', self.log, {})
|
||||
|
|
|
|||
|
|
@ -79,7 +79,13 @@ def extract_content(self, output_dir):
|
|||
|
||||
self.log.info('Converting text to OEB...')
|
||||
stream = StringIO(raw_txt)
|
||||
|
||||
from calibre.customize.ui import plugin_for_input_format
|
||||
|
||||
txt_plugin = plugin_for_input_format('txt')
|
||||
for option in txt_plugin.options:
|
||||
if not hasattr(self.options, option.option.name):
|
||||
setattr(self.options, option.name, option.recommend_val)
|
||||
|
||||
stream.seek(0)
|
||||
return plugin_for_input_format('txt').convert(stream, self.options,
|
||||
'txt', self.log, {})
|
||||
return txt_plugin.convert(stream, self.options, 'txt', self.log, {})
|
||||
|
|
|
|||
|
|
@ -41,7 +41,14 @@ def convert(self, stream, options, file_ext, log, accelerators):
|
|||
|
||||
log.info('Converting text to OEB...')
|
||||
stream = StringIO(raw_txt)
|
||||
|
||||
from calibre.customize.ui import plugin_for_input_format
|
||||
|
||||
txt_plugin = plugin_for_input_format('txt')
|
||||
for option in txt_plugin.options:
|
||||
if not hasattr(options, option.option.name):
|
||||
setattr(options, option.name, option.recommend_val)
|
||||
|
||||
stream.seek(0)
|
||||
return plugin_for_input_format('txt').convert(stream, options,
|
||||
return txt_plugin.convert(stream, options,
|
||||
'txt', log, accelerators)
|
||||
|
|
|
|||
Loading…
Reference in a new issue