From 3c79631a843528a0d9d6b290c1dbcce95ed45c89 Mon Sep 17 00:00:00 2001 From: notssh <51744301+notssh@users.noreply.github.com> Date: Sat, 28 Jan 2023 14:48:39 +0000 Subject: [PATCH 1/2] Update - avoid forbidden path symbols --- src/musort.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/musort.py b/src/musort.py index ece2615..a42fab7 100755 --- a/src/musort.py +++ b/src/musort.py @@ -127,6 +127,10 @@ class Music: rename.append(self.separator) rename.pop() rename = ''.join(rename)+ext + """Replacing forbidden path characters in UNIX and Windows with underscores""" + for forbidden_symbol in ['\\', '/', '|', '*', '<', '>', '"', '?']: + if forbidden_symbol in rename: + rename = rename.replace(forbidden_symbol, "_") """Get the absolute path and rename the audio file""" dst = os.path.join(os.path.abspath(os.path.dirname(file)), rename) From e87cc49b28a28ce038581f20411a5d187026fec9 Mon Sep 17 00:00:00 2001 From: notssh <51744301+notssh@users.noreply.github.com> Date: Sat, 28 Jan 2023 16:44:53 +0000 Subject: [PATCH 2/2] Update musort.py --- src/musort.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/musort.py b/src/musort.py index a42fab7..b818baa 100755 --- a/src/musort.py +++ b/src/musort.py @@ -128,9 +128,10 @@ class Music: rename.pop() rename = ''.join(rename)+ext """Replacing forbidden path characters in UNIX and Windows with underscores""" - for forbidden_symbol in ['\\', '/', '|', '*', '<', '>', '"', '?']: - if forbidden_symbol in rename: - rename = rename.replace(forbidden_symbol, "_") + for forbidden_character in ['\\', '/', '|', '*', '<', '>', '"', '?']: + if forbidden_character in rename: + logging.warning(f"Track '{track.artist}' - '{track.title}': found the forbidden path character ({forbidden_character}) in the new file name, replaced symbol with underscore") + rename = rename.replace(forbidden_character, "_") """Get the absolute path and rename the audio file""" dst = os.path.join(os.path.abspath(os.path.dirname(file)), rename)