diff --git a/calibre-plugin/fff_plugin.py b/calibre-plugin/fff_plugin.py index 45fb6423..08fb2f56 100644 --- a/calibre-plugin/fff_plugin.py +++ b/calibre-plugin/fff_plugin.py @@ -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): diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index 63fc05e6..2f1dad39 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -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 diff --git a/fanficfare/configurable.py b/fanficfare/configurable.py index e915733e..de87d470 100644 --- a/fanficfare/configurable.py +++ b/fanficfare/configurable.py @@ -366,6 +366,7 @@ def get_valid_keywords(): 'always_overwrite', 'anthology_tags', 'anthology_title_pattern', + 'anthology_merge_keepsingletocs', 'background_color', 'bulk_load', 'chapter_end',