Minor filename encoding improvement in a common case
This commit is contained in:
parent
fa59f4b6a9
commit
46cbda0be4
2 changed files with 10 additions and 0 deletions
|
@ -218,6 +218,9 @@ def sanitize_filename(s, restricted=False):
|
|||
while '__' in result:
|
||||
result = result.replace('__', '_')
|
||||
result = result.strip('_')
|
||||
# Common case of "Foreign band name - English song title"
|
||||
if restricted and result.startswith('-_'):
|
||||
result = result[2:]
|
||||
if not result:
|
||||
result = '_'
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue