From 6f7f07e690c1dd314441090643f873805c6f119f Mon Sep 17 00:00:00 2001 From: j Date: Fri, 18 Apr 2008 12:57:20 +0200 Subject: [PATCH] allow any delimiter for time values in srt files xx.yy.zz.zzz normalize to xx:yy:zz,zzz which is the most common --- oxdbarchive/subtitles.py | 1 + 1 file changed, 1 insertion(+) diff --git a/oxdbarchive/subtitles.py b/oxdbarchive/subtitles.py index da08032..23b1f9a 100644 --- a/oxdbarchive/subtitles.py +++ b/oxdbarchive/subtitles.py @@ -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: