From 0444d8dfcfc312f0806188c2eb619b3b99746c5a Mon Sep 17 00:00:00 2001 From: Mttw_ <97262476+m4t7w@users.noreply.github.com> Date: Sun, 11 May 2025 02:17:11 +0200 Subject: [PATCH] Update utils.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improves the regex to remove all ASCII control characters in the track name, because some artist found it funny to include them... before: 1. Bounce (Original Mix) after: 1. Bounce (Original Mix) --- utils/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/utils.py b/utils/utils.py index b830dfe..8640faf 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -19,7 +19,7 @@ def create_requests_session(): session_.mount('https://', HTTPAdapter(max_retries=retries)) return session_ -sanitise_name = lambda name : re.sub(r'[:]', ' - ', re.sub(r'[\\/*?"<>|$]', '', re.sub(r'[ \t]+$', '', str(name).rstrip()))) if name else '' +sanitise_name = lambda name: re.sub(r'[:]', ' - ', re.sub(r'[\\/*?"<>|$]', '', re.sub(r'[\x00-\x1F\x7F]', '', str(name).strip()))) if name else '' def fix_byte_limit(path: str, byte_limit=250):