def test_caption_timestamp_update(self): c = Caption('00:00:00.500', '00:00:07.000') c.start = '00:00:01.750' c.end = '00:00:08.250' self.assertEqual(c.start, '00:00:01.750') self.assertEqual(c.end, '00:00:08.250')
def _parse_cue_block(self, block): caption = Caption() cue_timings = None for line_number, line in enumerate(block.lines): if self._is_cue_timings_line(line): if cue_timings is None: try: cue_timings = self._parse_timeframe_line(line) except MalformedCaptionError as e: raise MalformedCaptionError('{} in line {}'.format( e, block.line_number + line_number)) else: raise MalformedCaptionError( '--> found in line {}'.format(block.line_number + line_number)) elif line_number == 0: caption.identifier = line else: caption.add_line(line) caption.start = cue_timings[0] caption.end = cue_timings[1] return caption