mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
Fix filename sanitation (Closes #555)
This commit is contained in:
parent
26396311b5
commit
dcd60025f8
1 changed files with 4 additions and 3 deletions
|
@ -327,8 +327,10 @@ def prepare_filename(self, info_dict):
|
||||||
"""Generate the output filename."""
|
"""Generate the output filename."""
|
||||||
try:
|
try:
|
||||||
template_dict = dict(info_dict)
|
template_dict = dict(info_dict)
|
||||||
template_dict['epoch'] = unicode(int(time.time()))
|
template_dict['epoch'] = int(time.time())
|
||||||
template_dict['autonumber'] = unicode('%05d' % self._num_downloads)
|
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
|
filename = self.params['outtmpl'] % template_dict
|
||||||
return filename
|
return filename
|
||||||
except (ValueError, KeyError), err:
|
except (ValueError, KeyError), err:
|
||||||
|
@ -368,7 +370,6 @@ def process_info(self, info_dict):
|
||||||
raise MaxDownloadsReached()
|
raise MaxDownloadsReached()
|
||||||
|
|
||||||
filename = self.prepare_filename(info_dict)
|
filename = self.prepare_filename(info_dict)
|
||||||
filename = sanitize_filename(filename, self.params.get('restrictfilenames'))
|
|
||||||
|
|
||||||
# Forced printings
|
# Forced printings
|
||||||
if self.params.get('forcetitle', False):
|
if self.params.get('forcetitle', False):
|
||||||
|
|
Loading…
Reference in a new issue