From bca2222559e47c980b1b33f2fd41477b11157df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 27 Nov 2019 19:42:46 +0100 Subject: [PATCH] add '--exec-after' --- gallery_dl/option.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/gallery_dl/option.py b/gallery_dl/option.py index f218db05..34222a21 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -306,13 +306,6 @@ def build_parser(): action="append_const", const={"name": "zip"}, help="Store downloaded files in a ZIP archive", ) - postprocessor.add_argument( - "--exec", - dest="postprocessors", metavar="CMD", - action=AppendCommandAction, const={"name": "exec"}, - help=("Execute CMD for each downloaded file. " - "Example: --exec 'magick convert {} {}.png && rm {}'"), - ) postprocessor.add_argument( "--ugoira-conv", dest="postprocessors", action="append_const", const={ @@ -352,6 +345,20 @@ def build_parser(): action="append_const", const={"name": "mtime"}, help="Set file modification times according to 'date' metadata", ) + postprocessor.add_argument( + "--exec", + dest="postprocessors", metavar="CMD", + action=AppendCommandAction, const={"name": "exec"}, + help=("Execute CMD for each downloaded file. " + "Example: --exec 'convert {} {}.png && rm {}'"), + ) + postprocessor.add_argument( + "--exec-after", + dest="postprocessors", metavar="CMD", + action=AppendCommandAction, const={"name": "exec", "final": True}, + help=("Execute CMD after all files were downloaded successfully. " + "Example: --exec-after 'cd {} && convert * ../doc.pdf'"), + ) parser.add_argument( "urls",