From: kaliko Date: Sun, 13 Dec 2020 16:34:42 +0000 (+0100) Subject: Avoid empty tags entries in config, strip space around values X-Git-Tag: 0.16.0~14 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=abd0ec90f9ae6ea8eae2bc1515fcc8358bb6d4c9;p=mpd-sima.git Avoid empty tags entries in config, strip space around values --- 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()}')")