mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
EPUB Output: Add an option to flatten the EPUB file structure, specially for FBReaderJ. Fixes #7788 (Flatten content of EPUB created by recipes to make them more compatible)
This commit is contained in:
parent
1b2bdfae81
commit
5f91edf752
@ -101,6 +101,13 @@ class EPUBOutput(OutputFormatPlugin):
|
||||
)
|
||||
),
|
||||
|
||||
OptionRecommendation(name='epub_flatten', recommended_value=False,
|
||||
help=_('This option is needed only if you intend to use the EPUB'
|
||||
' with FBReaderJ. It will flatten the file system inside the'
|
||||
' EPUB, putting all files into the top level.')
|
||||
),
|
||||
|
||||
|
||||
])
|
||||
|
||||
recommendations = set([('pretty_print', True, OptionRecommendation.HIGH)])
|
||||
@ -142,6 +149,10 @@ class EPUBOutput(OutputFormatPlugin):
|
||||
def convert(self, oeb, output_path, input_plugin, opts, log):
|
||||
self.log, self.opts, self.oeb = log, opts, oeb
|
||||
|
||||
if self.opts.epub_flatten:
|
||||
from calibre.ebooks.oeb.transforms.filenames import FlatFilenames
|
||||
FlatFilenames()(oeb, opts)
|
||||
else:
|
||||
from calibre.ebooks.oeb.transforms.filenames import UniqueFilenames
|
||||
UniqueFilenames()(oeb, opts)
|
||||
|
||||
|
@ -21,7 +21,7 @@ class PluginWidget(Widget, Ui_Form):
|
||||
Widget.__init__(self, parent,
|
||||
['dont_split_on_page_breaks', 'flow_size',
|
||||
'no_default_epub_cover', 'no_svg_cover',
|
||||
'preserve_cover_aspect_ratio',]
|
||||
'preserve_cover_aspect_ratio', 'epub_flatten']
|
||||
)
|
||||
for i in range(2):
|
||||
self.opt_no_svg_cover.toggle()
|
||||
|
@ -81,6 +81,13 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="opt_epub_flatten">
|
||||
<property name="text">
|
||||
<string>&Flatten EPUB file structure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@ -236,6 +236,10 @@ def fetch_scheduled_recipe(arg):
|
||||
recs.append(('header', True, OptionRecommendation.HIGH))
|
||||
recs.append(('header_format', '%t', OptionRecommendation.HIGH))
|
||||
|
||||
epub = load_defaults('epub_output')
|
||||
if epub.get('epub_flatten', False):
|
||||
recs.append(('epub_flatten', True, OptionRecommendation.HIGH))
|
||||
|
||||
args = [arg['recipe'], pt.name, recs]
|
||||
if arg['username'] is not None:
|
||||
recs.append(('username', arg['username'], OptionRecommendation.HIGH))
|
||||
|
Loading…
x
Reference in New Issue
Block a user