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
d6d768b917
commit
6f7f07e690
1 changed files with 1 additions and 0 deletions
|
@ -61,6 +61,7 @@ def dict2srt(subtitles, encoding = "utf-8"):
|
||||||
def time_str2msec(time_string):
|
def time_str2msec(time_string):
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import time
|
import time
|
||||||
|
time_string = re.sub('(\d{2}).(\d{2}).(\d{2}).(\d{3})', '\\1:\\2:\\3,\\4', time_string)
|
||||||
if len(time_string.split(',')) > 1:
|
if len(time_string.split(',')) > 1:
|
||||||
msec = float("0." + time_string.split(',')[-1])
|
msec = float("0." + time_string.split(',')[-1])
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue