about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-12-10 11:23:35 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-12-10 11:23:35 +0100
commit45598aab0873c31dd6200899192ddeb07bd2c472 (patch)
treef478cb82ee1c64710d50c0076b24115010a5d026
parent26e6393134b35121ab956a408250c565596dd2a1 (diff)
downloadyoutube-dl-45598aab0873c31dd6200899192ddeb07bd2c472.tar.gz
youtube-dl-45598aab0873c31dd6200899192ddeb07bd2c472.tar.xz
youtube-dl-45598aab0873c31dd6200899192ddeb07bd2c472.zip
[YoutubeDL] Simplify filename preparation
-rw-r--r--youtube_dl/YoutubeDL.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 11d4972dd..cabe30980 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -397,11 +397,12 @@ class YoutubeDL(object):
                 template_dict['playlist_index'] = u'%05d' % template_dict['playlist_index']
 
             sanitize = lambda k, v: sanitize_filename(
-                u'NA' if v is None else compat_str(v),
+                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())
+                                 for k, v in template_dict.items()
+                                 if v is not None)
             template_dict = collections.defaultdict(lambda: u'NA', template_dict)
 
             tmpl = os.path.expanduser(self.params['outtmpl'])