diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-10-22 22:28:19 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-10-22 22:28:26 +0200 |
commit | 586a91b67f6fe7254beefc3831b4e4649f84f0ce (patch) | |
tree | 283926c256718f41d106808b3e35a58f12e338d1 | |
parent | f8b45beacccbc5c237b0a04a568b51d602b1c1d3 (diff) |
Expand tilde in template (Fixes #1639)
-rw-r--r-- | youtube_dl/YoutubeDL.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 296c0f992..095692bb3 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -288,13 +288,15 @@ class YoutubeDL(object): if template_dict['playlist_index'] is not None: 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), 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') |