Update musort.py

This commit is contained in:
notssh
2023-01-28 16:44:53 +00:00
committed by GitHub
parent 3c79631a84
commit e87cc49b28

View File

@ -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)