From 5ddf7970b97a47c5cd630b5e65e71221ed6cd96a Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 6 Mar 2012 23:00:16 +0100 Subject: [PATCH] improve parser(handle empty subs) --- ox/srt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ox/srt.py b/ox/srt.py index ca5440f..15458e8 100644 --- a/ox/srt.py +++ b/ox/srt.py @@ -75,7 +75,7 @@ def load(filename, offset=0): return srt data = data.replace('\r\n', '\n') - srts = re.compile('(\d\d:\d\d:\d\d[,.]\d\d\d)\s*-->\s*(\d\d:\d\d:\d\d[,.]\d\d\d)\s*(.+?)\n\n', re.DOTALL) + srts = re.compile('(\d\d:\d\d:\d\d[,.]\d\d\d)\s*-->\s*(\d\d:\d\d:\d\d[,.]\d\d\d)\s*?(.+?)\n\n', re.DOTALL) i = 0 for s in srts.findall(data): _s = {'id': str(i),