]> kaliko git repositories - mpd-sima.git/commitdiff
Avoid empty tags entries in config, strip space around values
authorkaliko <kaliko@azylum.org>
Sun, 13 Dec 2020 16:34:42 +0000 (17:34 +0100)
committerkaliko <kaliko@azylum.org>
Mon, 14 Dec 2020 14:12:04 +0000 (15:12 +0100)
sima/plugins/internal/tags.py

index 005476728735464e9beb3a9dbe145390dadc5c93..9000c37cf6fa3af52a09222b5b776354efa247c7 100644 (file)
@@ -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()}')")