1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-26 15:32:54 +08:00

Trim and collapse whitespace from filename

This commit is contained in:
dyn888 2016-01-29 17:21:47 +01:00
parent 2b4f5e68d1
commit 797c86ad36

View File

@ -359,6 +359,7 @@ def sanitize_filename(s, restricted=False, is_id=False):
while '__' in result:
result = result.replace('__', '_')
result = result.strip('_')
result = " ".join(result.split())
# Common case of "Foreign band name - English song title"
if restricted and result.startswith('-_'):
result = result[2:]