diff --git a/lib/svtplay_dl/subtitle/__init__.py b/lib/svtplay_dl/subtitle/__init__.py index 8d700c4..04a3b27 100644 --- a/lib/svtplay_dl/subtitle/__init__.py +++ b/lib/svtplay_dl/subtitle/__init__.py @@ -479,7 +479,9 @@ def tt_text(node, data): def strdate(datestring): - match = re.search(r"^((\d+:\d+:\d+[\.,]*[0-9]*)?(\d+:\d+[\.,]*[0-9]*)?) --> ((\d+:\d+:\d+[\.,]*[0-9]*)?(\d+:\d+[\.,]*[0-9]*)?)$", datestring) + match = re.search(r"^((\d+:\d+:\d+[\.,]*[0-9]*)?(\d+:\d+[\.,]*[0-9]*)?) --> ((\d+:\d+:\d+[\.,]*[0-9]*)?(\d+:\d+[\.,]*[0-9]*)?)[ ]*", datestring) + if match and match.group(5) is None and match.group(6) is not None: + return None return match diff --git a/lib/svtplay_dl/tests/test_stream.py b/lib/svtplay_dl/tests/test_stream.py index a92352c..acb28d0 100644 --- a/lib/svtplay_dl/tests/test_stream.py +++ b/lib/svtplay_dl/tests/test_stream.py @@ -164,7 +164,7 @@ class streamSubtile(unittest.TestCase): subtitle(config, "wrst", "http://example.com", subfix="no"), ] subs = subtitle_filter(test_subs) - assert len(subs) == 4 + assert len(subs) == 3 def test_subtitleFilter3(self): config = setup_defaults() @@ -200,4 +200,4 @@ class streamSubtile(unittest.TestCase): subtitle(config, "wrst", "http://example.com", subfix="no"), ] subs = subtitle_filter(test_subs) - assert len(subs) == 3 + assert len(subs) == 2