aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--youtube_dl/YoutubeDL.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index f9a6da520..e2332f9b8 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -278,10 +278,12 @@ class YoutubeDL(object):
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())
+ 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
+ tmpl = os.path.expanduser(self.params['outtmpl'])
+ filename = tmpl % template_dict
return filename
except KeyError as err:
self.report_error(u'Erroneous output template')