mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:57:40 +00:00
Expand tilde in template (Fixes #1639)
This commit is contained in:
parent
f8b45beacc
commit
586a91b67f
1 changed files with 6 additions and 4 deletions
|
@ -288,13 +288,15 @@ class YoutubeDL(object):
|
||||||
if template_dict['playlist_index'] is not None:
|
if template_dict['playlist_index'] is not None:
|
||||||
template_dict['playlist_index'] = u'%05d' % template_dict['playlist_index']
|
template_dict['playlist_index'] = u'%05d' % template_dict['playlist_index']
|
||||||
|
|
||||||
sanitize = lambda k,v: sanitize_filename(
|
sanitize = lambda k, v: sanitize_filename(
|
||||||
u'NA' if v is None else compat_str(v),
|
u'NA' if v is None else compat_str(v),
|
||||||
restricted=self.params.get('restrictfilenames'),
|
restricted=self.params.get('restrictfilenames'),
|
||||||
is_id=(k==u'id'))
|
is_id=(k == u'id'))
|
||||||
template_dict = dict((k, sanitize(k, v)) for k,v in template_dict.items())
|
template_dict = dict((k, sanitize(k, v))
|
||||||
|
for k, v in template_dict.items())
|
||||||
|
|
||||||
filename = self.params['outtmpl'] % template_dict
|
tmpl = os.path.expanduser(self.params['outtmpl'])
|
||||||
|
filename = tmpl % template_dict
|
||||||
return filename
|
return filename
|
||||||
except KeyError as err:
|
except KeyError as err:
|
||||||
self.report_error(u'Erroneous output template')
|
self.report_error(u'Erroneous output template')
|
||||||
|
|
Loading…
Reference in a new issue