mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-15 21:32:28 +01:00
Adding pre_process_cmd for CLI.
This commit is contained in:
parent
c492b73e99
commit
34f695bb60
2 changed files with 25 additions and 0 deletions
|
|
@ -411,6 +411,12 @@ def do_download(arg,
|
|||
if not options.update and chaptercount == urlchaptercount and adapter.getConfig('do_update_hook'):
|
||||
adapter.hookForUpdates(chaptercount)
|
||||
|
||||
if adapter.getConfig('pre_process_safepattern'):
|
||||
metadata = adapter.story.get_filename_safe_metadata(pattern=adapter.getConfig('pre_process_safepattern'))
|
||||
else:
|
||||
metadata = adapter.story.getAllMetadata()
|
||||
call(string.Template(adapter.getConfig('pre_process_cmd')).substitute(metadata), shell=True)
|
||||
|
||||
write_story(configuration, adapter, 'epub')
|
||||
|
||||
else:
|
||||
|
|
@ -427,6 +433,13 @@ def do_download(arg,
|
|||
else:
|
||||
pprint.pprint(metadata)
|
||||
|
||||
if not options.metaonly and adapter.getConfig('pre_process_cmd'):
|
||||
if adapter.getConfig('pre_process_safepattern'):
|
||||
metadata = adapter.story.get_filename_safe_metadata(pattern=adapter.getConfig('pre_process_safepattern'))
|
||||
else:
|
||||
metadata = adapter.story.getAllMetadata()
|
||||
call(string.Template(adapter.getConfig('pre_process_cmd')).substitute(metadata), shell=True)
|
||||
|
||||
output_filename = write_story(configuration, adapter, options.format, options.metaonly)
|
||||
|
||||
if not options.metaonly and adapter.getConfig('post_process_cmd'):
|
||||
|
|
|
|||
|
|
@ -203,6 +203,18 @@ connect_timeout:60.0
|
|||
## each metadata item passed to post_process_cmd before it's called.
|
||||
#post_process_safepattern:(^\.|/\.|[^a-zA-Z0-9_\. \[\]\(\)&'-]+)
|
||||
|
||||
## For use only with CLI version--run a command 3*before* the output
|
||||
## file is written. All of the titlepage_entries values are
|
||||
## available, (but not output_filename). Can be used to generate
|
||||
## cover images that are then included in the output ebook using
|
||||
## default_cover_image.
|
||||
#pre_process_cmd:tenprintcover.py --author "${author}" --title "${title}" --cover cover.png
|
||||
|
||||
## Some operating systems and command shells have problems with some
|
||||
## characters. When set, pre_process_safepattern will be applied to
|
||||
## each metadata item passed to pre_process_cmd before it's called.
|
||||
#pre_process_safepattern:(^\.|/\.|[^a-zA-Z0-9_\. \[\]\(\)&'-]+)
|
||||
|
||||
## For use only with CLI version--display a simple progress bar while
|
||||
## downloading--one dot(.) per network fetch. Same as using --progressbar
|
||||
#progressbar:false
|
||||
|
|
|
|||
Loading…
Reference in a new issue