1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 17:27:21 +08:00

[nrk] Gracefully handle subtitle thousands with less than three digits

This commit is contained in:
Forthrin 2019-04-10 19:01:17 +02:00
parent d6343d6850
commit 3337739ba8

View File

@ -2729,9 +2729,9 @@ def parse_dfxp_time_expr(time_expr):
if mobj:
return float(mobj.group('time_offset'))
mobj = re.match(r'^(\d+):(\d\d):(\d\d(?:(?:\.|:)\d+)?)$', time_expr)
mobj = re.match(r'^(\d+):(\d\d):(\d\d)\.(\d{1,3})$', time_expr)
if mobj:
return 3600 * int(mobj.group(1)) + 60 * int(mobj.group(2)) + float(mobj.group(3).replace(':', '.'))
return 3600 * int(mobj.group(1)) + 60 * int(mobj.group(2)) + int(mobj.group(3)) + float("%03d" % int(mobj.group(4))) / 1000
def srt_subtitles_timecode(seconds):