瀏覽代碼

[extractor/common] Add subtitles timecode formatter

Sergey M․ 10 年之前
父節點
當前提交
4a34f69ea6
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      youtube_dl/extractor/common.py

+ 3 - 0
youtube_dl/extractor/common.py

@@ -1062,6 +1062,9 @@ class InfoExtractor(object):
     def _get_automatic_captions(self, *args, **kwargs):
         raise NotImplementedError("This method must be implemented by subclasses")
 
+    def _subtitles_timecode(self, seconds):
+        return '%02d:%02d:%02d.%03d' % (seconds / 3600, (seconds % 3600) / 60, seconds % 60, (seconds % 1) * 1000)
+
 
 class SearchInfoExtractor(InfoExtractor):
     """