Skip to content

timestamps without milliseconds #8

@jcable

Description

@jcable

Hi, I found an EBU-TT-D file where some timestamps are without milliseconds. I made this small change to accommodate this:

def fraction_timestamp_to_ms(self, timestamp):
    """Convert hh:mm:ss.fraction to milliseconds
    """
    if '.' in timestamp:
      hh, mm, ss, fraction = re.split(r'[:.]', timestamp)
    else:
      hh, mm, ss = re.split(r'[:]', timestamp)
      fraction = '0'
    hh, mm, ss = [int(i) for i in (hh, mm, ss)]
    # Resolution beyond ms is useless for our purposes
    ms = int(fraction[:3])
    
    return self._scaler(self._hhmmss_to_ms(hh, mm, ss) + ms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions