From 0a6e58b8baded560d670ec2c08124dfd628b80ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 14 Jul 2025 21:29:40 +0200 Subject: [PATCH] [actions] add 'flag' action --- gallery_dl/actions.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gallery_dl/actions.py b/gallery_dl/actions.py index d5a3486f..6bcebac9 100644 --- a/gallery_dl/actions.py +++ b/gallery_dl/actions.py @@ -180,6 +180,18 @@ def action_wait(opts): return None, _wait +def action_flag(opts): + flag, value = util.re( + r"(?i)(file|post|child|download)(?:\s*[= ]\s*(.+))?" + ).match(opts).groups() + flag = flag.upper() + value = "stop" if value is None else value.lower() + + def _flag(args): + util.FLAGS.__dict__[flag] = value + return _flag, None + + def action_abort(opts): return None, util.raises(exception.StopExtraction) @@ -207,6 +219,7 @@ ACTIONS = { "abort" : action_abort, "exec" : action_exec, "exit" : action_exit, + "flag" : action_flag, "level" : action_level, "print" : action_print, "restart" : action_restart,