aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/FileDownloader.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2012-11-27 18:27:46 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2012-11-27 18:27:46 +0100
commitdcd60025f89d3e87c0766b1163f7577c5e673342 (patch)
tree6239b4ce9b90cfdc30b052852920c903afe460bf /youtube_dl/FileDownloader.py
parent26396311b557696491152fd002f6d55e8126228b (diff)
Fix filename sanitation (Closes #555)
Diffstat (limited to 'youtube_dl/FileDownloader.py')
-rw-r--r--youtube_dl/FileDownloader.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py
index bd0f75773..d7d5b1521 100644
--- a/youtube_dl/FileDownloader.py
+++ b/youtube_dl/FileDownloader.py
@@ -327,8 +327,10 @@ class FileDownloader(object):
"""Generate the output filename."""
try:
template_dict = dict(info_dict)
- template_dict['epoch'] = unicode(int(time.time()))
- template_dict['autonumber'] = unicode('%05d' % self._num_downloads)
+ template_dict['epoch'] = int(time.time())
+ template_dict['autonumber'] = u'%05d' % self._num_downloads
+
+ template_dict = dict((k, sanitize_filename(compat_str(v), self.params.get('restrictfilenames'))) for k,v in template_dict.items())
filename = self.params['outtmpl'] % template_dict
return filename
except (ValueError, KeyError), err:
@@ -368,7 +370,6 @@ class FileDownloader(object):
raise MaxDownloadsReached()
filename = self.prepare_filename(info_dict)
- filename = sanitize_filename(filename, self.params.get('restrictfilenames'))
# Forced printings
if self.params.get('forcetitle', False):