From 2e3b598d4408c5de32836c17348dc3b543235662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonat=C3=A3=20Bolzan=20Loss?= <jonata@jonata.org> Date: Fri, 24 Apr 2020 23:08:16 -0300 Subject: [PATCH] Try to fix -> as time separator --- pysrt/srtitem.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pysrt/srtitem.py b/pysrt/srtitem.py index 5597905..2493b9c 100644 --- a/pysrt/srtitem.py +++ b/pysrt/srtitem.py @@ -20,7 +20,7 @@ class SubRipItem(ComparableMixin): position -> unicode: raw srt/vtt "display coordinates" string """ ITEM_PATTERN = str('%s\n%s --> %s%s\n%s\n') - TIMESTAMP_SEPARATOR = '-->' + TIMESTAMP_SEPARATOR = '->' def __init__(self, index=0, start=None, end=None, text='', position=''): try: @@ -95,6 +95,8 @@ def split_timestamps(cls, line): if len(timestamps) != 2: raise InvalidItem() start, end_and_position = timestamps + if start.endswith('-'): + start = start[:-1] end_and_position = end_and_position.lstrip().split(' ', 1) end = end_and_position[0] position = end_and_position[1] if len(end_and_position) > 1 else ''