"""Generate the output filename."""
try:
template_dict = dict(info_dict)
- template_dict['epoch'] = unicode(int(time.time()))
- template_dict['autonumber'] = unicode('%05d' % self._num_downloads)
++
+ template_dict['epoch'] = int(time.time())
+ template_dict['autonumber'] = u'%05d' % self._num_downloads
+
+ template_dict = dict((key, u'NA' if val is None else val) for key, val in template_dict.items())
+ template_dict = dict((k, sanitize_filename(u(v), self.params.get('restrictfilenames'))) for k,v in template_dict.items())
++
filename = self.params['outtmpl'] % template_dict
return filename
except (ValueError, KeyError), err: