From dbfaffc149b6423a0a2f31c10e028c417d4be3ef Mon Sep 17 00:00:00 2001 From: BORAHAN ARSLAN Date: Tue, 29 Oct 2024 16:38:36 +0300 Subject: [PATCH] Update subtitle_manager.py WebVTT change WEBVTT --- modules/utils/subtitle_manager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/utils/subtitle_manager.py b/modules/utils/subtitle_manager.py index d472a48..b260cb4 100644 --- a/modules/utils/subtitle_manager.py +++ b/modules/utils/subtitle_manager.py @@ -34,7 +34,7 @@ def get_srt(segments): def get_vtt(segments): - output = "WebVTT\n\n" + output = "WEBVTT\n\n" for i, segment in enumerate(segments): output += f"{timeformat_vtt(segment['start'])} --> {timeformat_vtt(segment['end'])}\n" if segment['text'].startswith(' '): @@ -76,7 +76,7 @@ def parse_srt(file_path): def parse_vtt(file_path): - """Reads WebVTT file and returns as dict""" + """Reads WEBVTT file and returns as dict""" with open(file_path, 'r', encoding='utf-8') as file: webvtt_data = file.read() @@ -84,7 +84,7 @@ def parse_vtt(file_path): blocks = webvtt_data.split('\n\n') for block in blocks: - if block.strip() != '' and not block.strip().startswith("WebVTT"): + if block.strip() != '' and not block.strip().startswith("WEBVTT"): lines = block.strip().split('\n') timestamp = lines[0] sentence = ' '.join(lines[1:]) @@ -107,7 +107,7 @@ def get_serialized_srt(dicts): def get_serialized_vtt(dicts): - output = "WebVTT\n\n" + output = "WEBVTT\n\n" for dic in dicts: output += f'{dic["timestamp"]}\n' output += f'{dic["sentence"]}\n\n'