Exemplo n.º 1
0
    def __init__(self, index=0, start=None, end=None, text='', position=''):
        try:
            self.index = int(index)
        except (TypeError, ValueError):  # try to cast as int, but it's not mandatory
            self.index = index

        self.start = SubRipTime.coerce(start or 0)
        self.end = SubRipTime.coerce(end or 0)
        self.position = str(position)
        self.text = str(text)
Exemplo n.º 2
0
    def __init__(self, index=0, start=None, end=None, text='', position=''):
        try:
            self.index = int(index)
        except (TypeError, ValueError): # try to cast as int, but it's not mandatory
            self.index = index

        self.start = SubRipTime.coerce(start or 0)
        self.end = SubRipTime.coerce(end or 0)
        self.position = str(position)
        self.text = str(text)
Exemplo n.º 3
0
    def __init__(self, index=0, start=None, end=None, text=u'', position=u''):
        try:
            self.index = int(index)
        except ValueError:
            raise InvalidIndex(repr(index))

        self.start = SubRipTime.coerce(start or 0)
        self.end = SubRipTime.coerce(end or 0)
        self.position = unicode(position)
        self.text = unicode(text)
Exemplo n.º 4
0
    def __init__(self, index=0, start=None, end=None, text=u'', position=u''):
        try:
            self.index = int(index)
        except ValueError:
            raise InvalidIndex(repr(index))

        self.start = SubRipTime.coerce(start or 0)
        self.end = SubRipTime.coerce(end or 0)
        self.position = unicode(position)
        self.text = unicode(text)
Exemplo n.º 5
0
    def text_at_time(self, time):
        """
        text_at_time()

        Get text that, according to subtitles, should appear on screen
        exactly at given time.
        """
        time = SubRipTime.coerce(time)

        for item in self:
            if item.start <= time and time <= item.end:
                return item.text
Exemplo n.º 6
0
 def __init__(self, index=0, start=None, end=None, text=u'', position=u''):
     self.index = int(index)
     self.start = SubRipTime.coerce(start or 0)
     self.end = SubRipTime.coerce(end or 0)
     self.position = unicode(position)
     self.text = unicode(text)