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:
j 2008-04-18 12:57:20 +02:00
parent d6d768b917
commit 6f7f07e690

View file

@ -61,6 +61,7 @@ def dict2srt(subtitles, encoding = "utf-8"):
def time_str2msec(time_string):
from datetime import datetime, timedelta
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:
msec = float("0." + time_string.split(',')[-1])
else: