浏览代码

[postprocessor/metadatafromtitle] Fix missing optional meta fields (closes #13408)

Sergey M․ 8 年之前
父节点
当前提交
be80986ed9
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      youtube_dl/postprocessor/metadatafromtitle.py

+ 6 - 3
youtube_dl/postprocessor/metadatafromtitle.py

@@ -35,11 +35,14 @@ class MetadataFromTitlePP(PostProcessor):
         title = info['title']
         title = info['title']
         match = re.match(self._titleregex, title)
         match = re.match(self._titleregex, title)
         if match is None:
         if match is None:
-            self._downloader.to_screen('[fromtitle] Could not interpret title of video as "%s"' % self._titleformat)
+            self._downloader.to_screen(
+                '[fromtitle] Could not interpret title of video as "%s"'
+                % self._titleformat)
             return [], info
             return [], info
         for attribute, value in match.groupdict().items():
         for attribute, value in match.groupdict().items():
-            value = match.group(attribute)
             info[attribute] = value
             info[attribute] = value
-            self._downloader.to_screen('[fromtitle] parsed ' + attribute + ': ' + value)
+            self._downloader.to_screen(
+                '[fromtitle] parsed %s: %s'
+                % (attribute, value if value is not None else 'NA'))
 
 
         return [], info
         return [], info