Add anthology_merge_keepsingletocs option, requires new EpubMerge.

This commit is contained in:
Jim Miller 2023-07-15 17:05:57 -05:00
parent 2c43eab432
commit cfd28dd1ff
3 changed files with 39 additions and 13 deletions

View file

@ -2069,13 +2069,25 @@ class FanFicFarePlugin(InterfaceAction):
coverpath = calcoverpath
# logger.debug('coverpath:%s'%coverpath)
self.get_epubmerge_plugin().do_merge(tmp.name,
[ x['outfile'] for x in good_list ],
tags=mergebook['tags'],
titleopt=mergebook['title'],
keepmetadatafiles=True,
source=mergebook['url'],
coverjpgpath=coverpath)
mrg_args = [tmp.name,
[ x['outfile'] for x in good_list ],]
mrg_kwargs = {
'tags':mergebook['tags'],
'titleopt':mergebook['title'],
'keepmetadatafiles':True,
'source':mergebook['url'],
'coverjpgpath':coverpath
}
logger.debug('anthology_merge_keepsingletocs:%s'%
mergebook['anthology_merge_keepsingletocs'])
if mergebook['anthology_merge_keepsingletocs']:
if self.get_epubmerge_plugin().interface_action_base_plugin.version >= (2,15,3):
mrg_kwargs['keepsingletocs']=mergebook['anthology_merge_keepsingletocs']
else:
logger.warn("anthology_merge_keepsingletocs:true ignored--your EpubMerge doesn't support it yet.")
self.get_epubmerge_plugin().do_merge(*mrg_args,**mrg_kwargs)
mergebook['collision'] = options['collision'] = OVERWRITEALWAYS
errorcol_label = self.get_custom_col_label(prefs['errorcol'])
@ -3022,6 +3034,10 @@ The previously downloaded book is still in the anthology, but FFF doesn't have t
if 'anthology_url' in options:
book['url'] = options['anthology_url']
# cheesy, but easier than getting hold of configuration again
# later.
book['anthology_merge_keepsingletocs'] = configuration.getConfig('anthology_merge_keepsingletocs',False)
return book
def split_text_to_urls(urls):

View file

@ -472,15 +472,24 @@ chapter_title_strip_pattern:^[0-9]+[\.: -]+(?=[^0-9]|$)
## be marked (new) and existing chapters will have any (new) marks
## removed.
##
## (Plugin Only) - New stories added to an existing anthology will
## have *all* chapters marked (new). If set to latestonly, existing
## (new) marks will only be removed when that particular story within
## the anthology is updated--either because it has new chapter(s) or
## you are using Update Always.
##
## mark_new_chapters can be true, false or latestonly
mark_new_chapters:false
## (Plugin Only) - When mark_new_chapters:true, new stories added to
## an existing anthology will have *all* chapters marked (new). If
## set to latestonly, existing (new) marks will only be removed when
## that particular story within the anthology is updated--either
## because it has new chapter(s) or you are using Update Always.
##
## By default, EpubMerge only creates one TOC entry for a story that
## has only one chapter (not counting titlepage and logpage). Because
## that TOC entry is the story title, the *chapter* title doesn't
## appear in the anthology TOC. Setting
## anthology_merge_keepsingletocs:true will keep the full TOC for all
## anthology stories, even when only one chapter. Helpful to see
## (new) marks in TOC when mark_new_chapters:true
#anthology_merge_keepsingletocs:false
## chapter title patterns use python template substitution. The
## ${number} is the 'chapter' number and ${title} is the chapter
## title, after applying chapter_title_strip_pattern. ${index04} is

View file

@ -366,6 +366,7 @@ def get_valid_keywords():
'always_overwrite',
'anthology_tags',
'anthology_title_pattern',
'anthology_merge_keepsingletocs',
'background_color',
'bulk_load',
'chapter_end',