diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2012-12-03 15:36:24 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2012-12-03 15:36:41 +0100 |
commit | 796173d08b514182eedc704541eb55d5c9e1dc0d (patch) | |
tree | fc25c18ca5724bfdf486106fe58dfa1d1c693d5c /youtube_dl/FileDownloader.py | |
parent | e575b6821ec185ef4f14c433ccc018d748c0fb60 (diff) |
Keep video IDs verbatim if possible (Closes #571)
Diffstat (limited to 'youtube_dl/FileDownloader.py')
-rw-r--r-- | youtube_dl/FileDownloader.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py index 48c8eb126..c471cc160 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -334,8 +334,11 @@ class FileDownloader(object): template_dict['epoch'] = int(time.time()) template_dict['autonumber'] = u'%05d' % self._num_downloads - template_dict = dict((key, u'NA' if val is None else val) for key, val in template_dict.items()) - template_dict = dict((k, sanitize_filename(compat_str(v), self.params.get('restrictfilenames'))) for k,v in template_dict.items()) + sanitize = lambda k,v: sanitize_filename( + u'NA' if v is None else compat_str(v), + restricted=self.params.get('restrictfilenames'), + is_id=(k==u'id')) + template_dict = dict((k, sanitize(k, v)) for k,v in template_dict.items()) filename = self.params['outtmpl'] % template_dict return filename |