1
0
mirror of https://github.com/l1ving/youtube-dl synced 2026-06-07 02:23:38 +08:00

Trim and collapse whitespace from filename

This commit is contained in:
dyn888
2016-01-29 17:21:47 +01:00
Unverified
parent 2b4f5e68d1
commit 797c86ad36
+1
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:]