and those without space
This commit is contained in:
parent
6f7f07e690
commit
33518260ee
1 changed files with 3 additions and 3 deletions
|
@ -30,9 +30,9 @@ def srt2dict(srt, encoding = "utf-8"):
|
||||||
if subtitle.strip():
|
if subtitle.strip():
|
||||||
subtitle = subtitle.strip().split('\n')
|
subtitle = subtitle.strip().split('\n')
|
||||||
if len(subtitle) > 2:
|
if len(subtitle) > 2:
|
||||||
start_stop = subtitle[1].split(' --> ')
|
start_stop = subtitle[1].split('-->')
|
||||||
start_stop[0] = start_stop[0].split(' ')[0]
|
start_stop[0] = start_stop[0].strip().split(' ')[0]
|
||||||
start_stop[1] = start_stop[1].split(' ')[0]
|
start_stop[1] = start_stop[1].strip().split(' ')[0]
|
||||||
start_stop[0] = re.sub('(\d{2}).(\d{2}).(\d{2}).(\d{3})', '\\1:\\2:\\3,\\4', start_stop[0])
|
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])
|
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])
|
subtitle[0] ="%s" % int(subtitle[0])
|
||||||
|
|
Loading…
Reference in a new issue