Subtitle

class Subtitle(lines=None, start=0, duration=1000, parent=None, index=None, next=None, previous=None)[source]

Represents a single subtitle.

Example:

>>> import subsy
>>> subtitle = subsy.Subtitle(['First line.', 'Line <i>with</i> markup.'])
>>> subtitle.lines
['First line.', 'Line <i>with</i> markup.']
>>> subtitle.text
'First line.\nLine <i>with</i> markup.'
>>> subtitle.plain
'First line.\nLine with markup.'
>>> subtitle.start
0
>>> subtitle.start_time
'00:00:00.000'
>>> subtitle.end_time
'00:00:01.000'
>>> subtitle.end_time = '00:00:02.000'
>>> subtitle.end
2000
lines

List of individual lines of the subtitle’s text.

start

Start time in milliseconds.

duration

Duration in milliseconds.

parent

Sequence, if any, that this subtitle belongs to.

index

Index number if part of a sequence.

next

Next subtitle if part of a sequence.

previous

Previous subtitle if part of a sequence.

property prev

Alias for previous.

property start_time

Start time in time-stamp format hh:mm:ss.ms.

property end_time

End time in time-stamp format hh:mm:ss.ms.

property text

The entire text of the subtitle, all lines joined together.

property plain

The entire text, but any markup removed.