allow any delimiter for time values in srt files xx.yy.zz.zzz normalize to xx:yy:zz,zzz which is the most common
This commit is contained in:
parent
079f143abc
commit
d6d768b917
1 changed files with 3 additions and 4 deletions
|
@ -33,9 +33,8 @@ def srt2dict(srt, encoding = "utf-8"):
|
|||
start_stop = subtitle[1].split(' --> ')
|
||||
start_stop[0] = start_stop[0].split(' ')[0]
|
||||
start_stop[1] = start_stop[1].split(' ')[0]
|
||||
if start_stop[0][-4] == '.':
|
||||
start_stop[0][:-4] + ',' + start_stop[0][-3:]
|
||||
start_stop[1][:-4] + ',' + start_stop[1][-3:]
|
||||
start_stop[0] = re.sub('(\d{2}).(\d{2}).(\d{2}).(\d{3})', '\\1:\\2:\\3,\\4', start_stop[0])
|
||||
start_stop[1] = re.sub('(\d{2}).(\d{2}).(\d{2}).(\d{3})', '\\1:\\2:\\3,\\4', start_stop[1])
|
||||
subtitle[0] ="%s" % int(subtitle[0])
|
||||
subdict[subtitle[0]] = {
|
||||
'start': start_stop[0],
|
||||
|
|
Loading…
Reference in a new issue