diff --git a/docs/configuration.rst b/docs/configuration.rst index 92fe8838..373f9f41 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -984,6 +984,10 @@ Description | Can be one of ``debug``, ``info``, ``warning``, ``error`` or an integer value. ``print`` Write argument to stdout. + ``abort``: + Stop the current extractor run. + ``terminate``: + Stop the current extractor run, including parent extractors. ``restart``: Restart the current extractor run. ``wait``: diff --git a/gallery_dl/__init__.py b/gallery_dl/__init__.py index 1d4215ec..ad35745d 100644 --- a/gallery_dl/__init__.py +++ b/gallery_dl/__init__.py @@ -299,6 +299,8 @@ def main(): else: input_manager.success() + except exception.StopExtraction: + pass except exception.TerminateExtraction: pass except exception.RestartExtraction: diff --git a/gallery_dl/actions.py b/gallery_dl/actions.py index 6d86a680..8362c744 100644 --- a/gallery_dl/actions.py +++ b/gallery_dl/actions.py @@ -86,6 +86,14 @@ def action_wait(opts): return _wait +def action_abort(opts): + return util.raises(exception.StopExtraction) + + +def action_terminate(opts): + return util.raises(exception.TerminateExtraction) + + def action_restart(opts): return util.raises(exception.RestartExtraction) @@ -102,10 +110,12 @@ def action_exit(opts): ACTIONS = { - "print" : action_print, - "status" : action_status, - "level" : action_level, - "restart": action_restart, - "wait" : action_wait, - "exit" : action_exit, + "print" : action_print, + "status" : action_status, + "level" : action_level, + "abort" : action_abort, + "terminate": action_terminate, + "restart" : action_restart, + "wait" : action_wait, + "exit" : action_exit, }