diff --git a/calibre-plugin/fff_plugin.py b/calibre-plugin/fff_plugin.py index 63f0621ed..f1a85704c 100644 --- a/calibre-plugin/fff_plugin.py +++ b/calibre-plugin/fff_plugin.py @@ -1548,7 +1548,7 @@ def prep_download_loop(self,book, if chaptercount == urlchaptercount: if collision == UPDATE: raise NotGoingToDownload(_("Already contains %d chapters.")%chaptercount,'edit-undo.png',showerror=False) - elif chaptercount > urlchaptercount: + elif chaptercount > urlchaptercount and not (collision == UPDATEALWAYS and adapter.getConfig('force_update_epub_always')): raise NotGoingToDownload(_("Existing epub contains %d chapters, web site only has %d. Use Overwrite to force update.") % (chaptercount,urlchaptercount),'dialog_error.png') elif chaptercount == 0: raise NotGoingToDownload(_("FanFicFare doesn't recognize chapters in existing epub, epub is probably from a different source. Use Overwrite to force update."),'dialog_error.png') diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index 6954370cf..0300d611a 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -1286,6 +1286,17 @@ nook_img_fix:true ## useful for CLI and web service--the calibre plugin doesn't need it. #calibre_series_meta:false +## By default, FanFicFare will not update an existing EPUB that has +## more chapters than the story does on the source site. When +## force_update_epub_always:true FFF will ignore that check when using +## 'Update EPUB Always' (plugin) or -U/--update-epub-always (CLI) and +## will discard chapters in the EPUB that are not listed on the source +## site anymore. +## This can be useful for authors that remove and/or replace chapters. +## Recommended to be set for individual stories or sites rather than +## under [defaults] or [epub]. +#force_update_epub_always:false + [html] ## include images from img tags in the body and summary of diff --git a/fanficfare/cli.py b/fanficfare/cli.py index 3b7b2a16a..97747f4aa 100644 --- a/fanficfare/cli.py +++ b/fanficfare/cli.py @@ -460,7 +460,7 @@ def do_download(arg, if chaptercount == urlchaptercount and not options.metaonly and not options.updatealways: print('%s already contains %d chapters.' % (output_filename, chaptercount)) - elif chaptercount > urlchaptercount: + elif chaptercount > urlchaptercount and not (options.updatealways and adapter.getConfig('force_update_epub_always')): warn('%s contains %d chapters, more than source: %d.' % (output_filename, chaptercount, urlchaptercount)) elif chaptercount == 0: warn("%s doesn't contain any recognizable chapters, probably from a different source. Not updating." % output_filename) diff --git a/fanficfare/configurable.py b/fanficfare/configurable.py index c8b7d9907..840f9a708 100644 --- a/fanficfare/configurable.py +++ b/fanficfare/configurable.py @@ -253,6 +253,7 @@ def get_valid_set_options(): 'logpage_at_end':(None,['epub'],boollist), 'calibre_series_meta':(None,['epub'],boollist), + 'force_update_epub_always':(None,['epub'],boollist), 'windows_eol':(None,['txt'],boollist), @@ -412,6 +413,7 @@ def get_valid_keywords(): 'include_logpage', 'logpage_at_end', 'calibre_series_meta', + 'force_update_epub_always', 'include_subject_tags', 'include_titlepage', 'include_tocpage', diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index e6e17d26d..0f0a5f3ec 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -1285,6 +1285,17 @@ nook_img_fix:true ## useful for CLI and web service--the calibre plugin doesn't need it. #calibre_series_meta:false +## By default, FanFicFare will not update an existing EPUB that has +## more chapters than the story does on the source site. When +## force_update_epub_always:true FFF will ignore that check when using +## 'Update EPUB Always' (plugin) or -U/--update-epub-always (CLI) and +## will discard chapters in the EPUB that are not listed on the source +## site anymore. +## This can be useful for authors that remove and/or replace chapters. +## Recommended to be set for individual stories or sites rather than +## under [defaults] or [epub]. +#force_update_epub_always:false + [html] ## include images from img tags in the body and summary of