mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -62,7 +62,13 @@ class Reader(FormatReader):
|
|||||||
|
|
||||||
self.log.info('Converting text to OEB...')
|
self.log.info('Converting text to OEB...')
|
||||||
stream = StringIO(raw_txt)
|
stream = StringIO(raw_txt)
|
||||||
|
|
||||||
from calibre.customize.ui import plugin_for_input_format
|
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)
|
stream.seek(0)
|
||||||
return plugin_for_input_format('txt').convert(stream, self.options,
|
return txt_plugin.convert(stream, self.options, 'txt', self.log, {})
|
||||||
'txt', self.log, {})
|
|
||||||
|
@ -79,7 +79,13 @@ class Reader(FormatReader):
|
|||||||
|
|
||||||
self.log.info('Converting text to OEB...')
|
self.log.info('Converting text to OEB...')
|
||||||
stream = StringIO(raw_txt)
|
stream = StringIO(raw_txt)
|
||||||
|
|
||||||
from calibre.customize.ui import plugin_for_input_format
|
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)
|
stream.seek(0)
|
||||||
return plugin_for_input_format('txt').convert(stream, self.options,
|
return txt_plugin.convert(stream, self.options, 'txt', self.log, {})
|
||||||
'txt', self.log, {})
|
|
||||||
|
@ -41,7 +41,14 @@ class TCRInput(InputFormatPlugin):
|
|||||||
|
|
||||||
log.info('Converting text to OEB...')
|
log.info('Converting text to OEB...')
|
||||||
stream = StringIO(raw_txt)
|
stream = StringIO(raw_txt)
|
||||||
|
|
||||||
from calibre.customize.ui import plugin_for_input_format
|
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)
|
stream.seek(0)
|
||||||
return plugin_for_input_format('txt').convert(stream, options,
|
return txt_plugin.convert(stream, options,
|
||||||
'txt', log, accelerators)
|
'txt', log, accelerators)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user