import string def my_normal(filename): d = filename # check the content d = string.replace(d, " Audio Track", "") # lower case d = string.lower(d) # retrieve accents d = string.replace(d, "", "a") d = string.replace(d, "", "e") d = string.replace(d, "\xcc\x81", "") d = string.replace(d, "", "e") d = string.replace(d, "", "e") d = string.replace(d, "", "i") d = string.replace(d, "", "o") d = string.replace(d, "", "u") d = string.replace(d, "", "u") d = string.replace(d, "", "c") # retrieve special characters d = string.replace(d, " ", "_") d = string.replace(d, "-", "_") d = string.replace(d, ":", "_") d = string.replace(d, ";", "_") d = string.replace(d, ",", "") d = string.replace(d, "~1", "") # if there are several points leave the last one splits = d.split('.') if len(splits)>2: body = '' for split in splits[0:-1]: body += split ext = splits[-1] body = string.replace(body, ".", "_") d = body+'.'+ext # chek the numbering (at least three numbers filled with zeros) return d