示例#1
0
 def setup_method(self, method):
     self.tsub = aeidon.Subtitle()
     self.tsub.mode = TIME
     self.tsub.framerate = aeidon.framerates.FPS_25_000
     self.tsub.start = "00:00:01.000"
     self.tsub.end = "00:00:03.000"
     self.tsub.main_text = "main"
     self.tsub.tran_text = "translation"
     self.fsub = aeidon.Subtitle()
     self.fsub.mode = FRAME
     self.fsub.framerate = aeidon.framerates.FPS_25_000
     self.fsub.start = 100
     self.fsub.end = 300
     self.fsub.main_text = "main"
     self.fsub.tran_text = "translation"
示例#2
0
 def _append_subtitle(self, index):
     """Create subtitle from `index` and append to page."""
     if index < 0:
         index += len(self._starts)
     advance = gaupol.conf.speech_recognition.advance_length
     advance = aeidon.as_seconds(advance / 1000)  # ms to s
     subtitle = aeidon.Subtitle(mode=aeidon.modes.TIME)
     start = self._starts[index] - advance
     start = max(start, self._stops[index - 1] if index > 0 else 0.0)
     subtitle.start = aeidon.as_seconds(start)
     subtitle.end = aeidon.as_seconds(self._stops[index])
     subtitle.main_text = self._texts[index] or ("[{:d}]".format(index + 1))
     indices = (len(self._page.project.subtitles), )
     self._page.project.insert_subtitles(indices, (subtitle, ),
                                         register=None)
示例#3
0
文件: util.py 项目: harelkh/gaupol
 def new_subtitle(self):
     """Return a new :class:`aeidon.Subtitle` instance."""
     return aeidon.Subtitle(self.get_mode(), self.framerate)
示例#4
0
 def _get_subtitle(self):
     """Return a new subtitle instance with proper properties."""
     return aeidon.Subtitle(self.mode)