summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorvitiko98 <[email protected]>2022-09-02 23:35:56 -0400
committervitiko98 <[email protected]>2022-09-02 23:37:17 -0400
commit6e521143e1de1f720dd9cf908aa7c907696187f0 (patch)
tree5709e69b4590daeb274a4255bf679244d4db9ddc /tests
parent0bc05232ed69be8dd727ce70e24e68e9d7362367 (diff)
downloadbazarr-6e521143e1de1f720dd9cf908aa7c907696187f0.tar.gz
bazarr-6e521143e1de1f720dd9cf908aa7c907696187f0.zip
Embedded Subtitles provider: improve ASS subtitles filtering
Diffstat (limited to 'tests')
-rw-r--r--tests/subliminal_patch/test_embeddedsubtitles.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/subliminal_patch/test_embeddedsubtitles.py b/tests/subliminal_patch/test_embeddedsubtitles.py
index d858581f8..ab0dc1c41 100644
--- a/tests/subliminal_patch/test_embeddedsubtitles.py
+++ b/tests/subliminal_patch/test_embeddedsubtitles.py
@@ -10,6 +10,7 @@ from subliminal_patch.core import Episode
from subliminal_patch.core import Movie
from subliminal_patch.providers.embeddedsubtitles import (
_discard_possible_incomplete_subtitles,
+ _clean_ass_subtitles,
)
from subliminal_patch.providers.embeddedsubtitles import _get_pretty_release_name
from subliminal_patch.providers.embeddedsubtitles import _MemoizedFFprobeVideoContainer
@@ -283,6 +284,20 @@ def test_get_pretty_release_name():
assert _get_pretty_release_name(stream, container) == "foo.en.forced.srt"
+def test_clean_ass_subtitles(data, tmp_path):
+ path = os.path.join(data, "subs.ass")
+
+ with open(path, "r") as f:
+ og_lines_len = len(f.readlines())
+
+ output_path = os.path.join(tmp_path, "subs.ass")
+
+ _clean_ass_subtitles(path, output_path)
+
+ with open(output_path, "r") as f:
+ assert og_lines_len > len(f.readlines())
+
+
def test_download_subtitle_multiple(video_multiple_languages):
with EmbeddedSubtitlesProvider() as provider:
languages = {Language.fromalpha2(code) for code in ("en", "it", "fr")} | {