More bugs in replace_illegal_chars

This commit is contained in:
rembo10
2014-04-08 12:52:14 -07:00
parent ae7dc456ca
commit 93d4df29a6
2 changed files with 3 additions and 3 deletions

View File

@@ -179,9 +179,9 @@ def replace_all(text, dic):
def replace_illegal_chars(string, type="file"):
if type == "file":
string = re.sub('[\?"*:|<>/]', string)
string = re.sub('[\?"*:|<>/]', '_', string)
if type == "folder":
string = re.sub('[:?<>"|]', string)
string = re.sub('[:\?<>"|]', '_', string)
return string

View File

@@ -907,7 +907,7 @@ def renameFiles(albumpath, downloaded_track_list, release):
new_file_name = helpers.replace_all(headphones.FILE_FORMAT.strip(), values).replace('/','_') + ext
new_file_name = new_file_name.replace('?','_').replace(':', '_').replace('"','_').replace('*','_').encode(headphones.SYS_ENCODING, 'replace')
new_file_name = helpers.replace_illegal_chars(new_file_name).encode(headphones.SYS_ENCODING, 'replace')
if headphones.FILE_UNDERSCORES:
new_file_name = new_file_name.replace(' ', '_')