From ecb9955328e7904bd6e92525717337322d9db88c Mon Sep 17 00:00:00 2001 From: zackees Date: Tue, 9 May 2023 20:48:18 -0700 Subject: [PATCH] adds missing function --- src/video_subtitles/convert_to_webvtt.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/video_subtitles/convert_to_webvtt.py diff --git a/src/video_subtitles/convert_to_webvtt.py b/src/video_subtitles/convert_to_webvtt.py new file mode 100644 index 0000000..f408308 --- /dev/null +++ b/src/video_subtitles/convert_to_webvtt.py @@ -0,0 +1,13 @@ +""" +Conversion to test to webvtt format. +""" + + +import webvtt # pylint: disable=import-error + + +def convert_to_webvtt(srt_file: str, out_webvtt_file: str) -> None: + """Convert to webvtt format.""" + assert srt_file.endswith(".srt") + assert out_webvtt_file.endswith(".vtt") + webvtt.from_srt(srt_file).save(out_webvtt_file)