From cc1b34c4b73c70696e3581fc8e12912bb70725a1 Mon Sep 17 00:00:00 2001 From: Martin Wagner Date: Thu, 5 Aug 2021 23:24:18 +0200 Subject: [PATCH] fixed custom regex --- bin/mpdevil | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/mpdevil b/bin/mpdevil index 1a333c3..d5ca293 100755 --- a/bin/mpdevil +++ b/bin/mpdevil @@ -751,13 +751,13 @@ class Client(MPDClient): if lib_path is not None: regex_str=self._settings.get_value("regex")[active_profile] if regex_str: - regex_str=regex_str.replace("%AlbumArtist%", song["albumartist"][0]) - regex_str=regex_str.replace("%Album%", song["album"][0]) + regex_str=regex_str.replace("%AlbumArtist%", re.escape(song["albumartist"][0])) + regex_str=regex_str.replace("%Album%", re.escape(song["album"][0])) try: regex=re.compile(regex_str, flags=re.IGNORECASE) - except: + except re.error: print("illegal regex:", regex_str) - return (None, None) + return None else: regex=re.compile(COVER_REGEX, flags=re.IGNORECASE) song_dir=os.path.join(lib_path, os.path.dirname(song_file))