From 7d9d2c7680352e109bd0cd66fa1f8553839f6c6f Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Mon, 15 Dec 2014 22:19:58 +0100 Subject: [PATCH] sami: they started to use : instead of , --- lib/svtplay_dl/subtitle/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/svtplay_dl/subtitle/__init__.py b/lib/svtplay_dl/subtitle/__init__.py index c2494e7..eb00d05 100644 --- a/lib/svtplay_dl/subtitle/__init__.py +++ b/lib/svtplay_dl/subtitle/__init__.py @@ -84,10 +84,11 @@ class subtitle(object): for i in subt.getiterator(): if i.tag == "Subtitle": n = i.attrib["SpotNumber"] + if i.attrib["SpotNumber"] == "1": - subs += "%s\n%s --> %s\n" % (i.attrib["SpotNumber"], i.attrib["TimeIn"], i.attrib["TimeOut"]) + subs += "%s\n%s --> %s\n" % (i.attrib["SpotNumber"], timecolon(i.attrib["TimeIn"]), timecolon(i.attrib["TimeOut"])) else: - subs += "\n%s\n%s --> %s\n" % (i.attrib["SpotNumber"], i.attrib["TimeIn"], i.attrib["TimeOut"]) + subs += "\n%s\n%s --> %s\n" % (i.attrib["SpotNumber"], timecolon(i.attrib["TimeIn"]), timecolon(i.attrib["TimeOut"])) else: if int(n) > 0: subs += "%s\n" % i.text @@ -176,6 +177,10 @@ def timestr(msec): output = "%02d:%02d:%05.2f" % (hours, minutes, sec) return output.replace(".", ",") +def timecolon(data): + match = re.search("(\d+:\d+:\d+):(\d+)", data) + return "%s,%s" % (match.group(1), match.group(2)) + def norm(name): if name[0] == "{": _, tag = name[1:].split("}")