From d713d33e67cd8040ebd6f9155ab5b918bc24d3f5 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Wed, 29 Nov 2023 00:05:08 +0100 Subject: [PATCH] subtitle: they have css align after the timecode --- lib/svtplay_dl/subtitle/__init__.py | 4 +++- lib/svtplay_dl/tests/test_stream.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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