[YoutubeDL] Simplify filename preparation
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 10 Dec 2013 10:23:35 +0000 (11:23 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 10 Dec 2013 10:23:35 +0000 (11:23 +0100)
youtube_dl/YoutubeDL.py

index 11d4972dd668722b4db93dd3cb7bd7b9d95b1050..cabe309802c68fc56bdff49d34e5ea2b5d216fd2 100644 (file)
@@ -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'])