From 33518260eecbac666365fc534bef055926dd879f Mon Sep 17 00:00:00 2001 From: j Date: Mon, 21 Apr 2008 10:16:46 +0200 Subject: [PATCH] and those without space --- oxdbarchive/subtitles.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oxdbarchive/subtitles.py b/oxdbarchive/subtitles.py index 23b1f9a..4ee6c9a 100644 --- a/oxdbarchive/subtitles.py +++ b/oxdbarchive/subtitles.py @@ -30,9 +30,9 @@ def srt2dict(srt, encoding = "utf-8"): if subtitle.strip(): subtitle = subtitle.strip().split('\n') if len(subtitle) > 2: - start_stop = subtitle[1].split(' --> ') - start_stop[0] = start_stop[0].split(' ')[0] - start_stop[1] = start_stop[1].split(' ')[0] + start_stop = subtitle[1].split('-->') + start_stop[0] = start_stop[0].strip().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[1] = re.sub('(\d{2}).(\d{2}).(\d{2}).(\d{3})', '\\1:\\2:\\3,\\4', start_stop[1]) subtitle[0] ="%s" % int(subtitle[0])