From abd0ec90f9ae6ea8eae2bc1515fcc8358bb6d4c9 Mon Sep 17 00:00:00 2001 From: kaliko Date: Sun, 13 Dec 2020 17:34:42 +0100 Subject: [PATCH] Avoid empty tags entries in config, strip space around values --- sima/plugins/internal/tags.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sima/plugins/internal/tags.py b/sima/plugins/internal/tags.py index 0054767..9000c37 100644 --- a/sima/plugins/internal/tags.py +++ b/sima/plugins/internal/tags.py @@ -38,8 +38,10 @@ def forge_filter(cfg): if cfg_filter: mpd_filter.append(cfg_filter) for tag in tags: + if not cfg[tag]: # avoid empty tags entries in config + continue if ',' in cfg[tag]: - patt = '|'.join(cfg[tag].split(',')) + patt = '|'.join(map(str.strip, cfg[tag].split(','))) mpd_filter.append(f"({tag} =~ '({patt})')") else: mpd_filter.append(f"({tag} == '{cfg[tag].strip()}')") -- 2.39.5