Skip to content

Commit 793a197

Browse files
Reintroduce support for "extended" srt
1 parent 0414edd commit 793a197

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pycaption/srt.py

+9
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ def read(self, content, lang='en-US', strip_html=False, strip_ass_tags=False):
6767

6868
def _srttomicro(self, stamp):
6969
timesplit = stamp.split(':')
70+
71+
# TODO(apeterka): add better support for "extended SRT"
72+
# This is a workaround for "extended SRT" format, whose timestamp looks like this:
73+
# 00:00:18,208 --> 00:00:20,792 X1:230 X2:490 Y1:393 Y2:431
74+
if len(timesplit) > 3:
75+
timesplit = timesplit[0:3]
76+
if ' ' in timesplit[2]:
77+
timesplit[2] = timesplit[2].split(' ')[0]
78+
7079
if ',' not in timesplit[2]:
7180
timesplit[2] += ',000'
7281
secsplit = timesplit[2].split(',')

0 commit comments

Comments
 (0)