mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-15 16:19:28 +01:00
More bugs in replace_illegal_chars
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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(' ', '_')
|
||||
|
||||
Reference in New Issue
Block a user