1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[actions] add 'abort' and 'terminate' actions (#5778)

This commit is contained in:
Mike Fährmann 2024-06-29 19:03:49 +02:00
parent d80f4fbc10
commit c9860002ba
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 22 additions and 6 deletions

View File

@ -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``:

View File

@ -299,6 +299,8 @@ def main():
else:
input_manager.success()
except exception.StopExtraction:
pass
except exception.TerminateExtraction:
pass
except exception.RestartExtraction:

View File

@ -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,
}