From d80f4fbc104bd559bc5a688cc65b7e7128cb9428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 29 Jun 2024 18:57:48 +0200 Subject: [PATCH] [actions] optimize empty patterns --- gallery_dl/actions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gallery_dl/actions.py b/gallery_dl/actions.py index 883e38b0..6d86a680 100644 --- a/gallery_dl/actions.py +++ b/gallery_dl/actions.py @@ -27,7 +27,8 @@ def parse(actionspec): for event, spec in actionspec: level, _, pattern = event.partition(":") type, _, args = spec.partition(" ") - action = (re.compile(pattern).search, ACTIONS[type](args)) + search = re.compile(pattern).search if pattern else util.true + action = (search, ACTIONS[type](args)) level = level.strip() if not level or level == "*": @@ -36,7 +37,6 @@ def parse(actionspec): actions_w.append(action) actions_e.append(action) else: - actions[_level_to_int(level)].append(action) return actions