From 0828643c0943688dd72d60c7e3c78e9a36012810 Mon Sep 17 00:00:00 2001 From: Ade Date: Tue, 26 Sep 2017 11:06:34 +1300 Subject: [PATCH] Replace windows file/folder problem characters --- headphones/helpers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/headphones/helpers.py b/headphones/helpers.py index 05f6108b..6a117fc1 100644 --- a/headphones/helpers.py +++ b/headphones/helpers.py @@ -22,6 +22,7 @@ import time import sys import tempfile import glob +from unidecode import unidecode from beets import logging as beetslogging import six @@ -223,7 +224,11 @@ def replace_illegal_chars(string, type="file"): if type == "file": string = re.sub('[\?"*:|<>/]', '_', string) if type == "folder": - string = re.sub('[:\?<>"|]', '_', string) + string = re.sub('[:\?<>"|*]', '_', string) + + # Asciify windows file/folder names + if sys.platform == "win32": + string = unidecode(string) return string