Use None on missing required info_dict fields
[youtube-dl] / youtube_dl / FileDownloader.py
index 1fdd2071ff2a99e0a1bed36a05abb7c8df4ff89e..a7997c4f2d26d8edddab0cb6360e06a033c95767 100644 (file)
@@ -327,6 +327,7 @@ class FileDownloader(object):
                        template_dict = dict(info_dict)
                        template_dict['epoch'] = unicode(int(time.time()))
                        template_dict['autonumber'] = unicode('%05d' % self._num_downloads)
+                       template_dict = dict((key, u'NA' if val is None else val) for key, val in template_dict.items())
                        filename = self.params['outtmpl'] % template_dict
                        return filename
                except (ValueError, KeyError), err: