Spaces:
Running
Running
jhj0517
commited on
Commit
·
8ac99d5
1
Parent(s):
89b559f
Fix vtt format
Browse files
modules/utils/subtitle_manager.py
CHANGED
|
@@ -86,8 +86,8 @@ def parse_vtt(file_path):
|
|
| 86 |
for block in blocks:
|
| 87 |
if block.strip() != '' and not block.strip().startswith("WebVTT"):
|
| 88 |
lines = block.strip().split('\n')
|
| 89 |
-
timestamp = lines[
|
| 90 |
-
sentence = ' '.join(lines[
|
| 91 |
|
| 92 |
data.append({
|
| 93 |
"timestamp": timestamp,
|
|
@@ -109,7 +109,6 @@ def get_serialized_srt(dicts):
|
|
| 109 |
def get_serialized_vtt(dicts):
|
| 110 |
output = "WebVTT\n\n"
|
| 111 |
for dic in dicts:
|
| 112 |
-
output += f'{dic["index"]}\n'
|
| 113 |
output += f'{dic["timestamp"]}\n'
|
| 114 |
output += f'{dic["sentence"]}\n\n'
|
| 115 |
return output
|
|
|
|
| 86 |
for block in blocks:
|
| 87 |
if block.strip() != '' and not block.strip().startswith("WebVTT"):
|
| 88 |
lines = block.strip().split('\n')
|
| 89 |
+
timestamp = lines[0]
|
| 90 |
+
sentence = ' '.join(lines[1:])
|
| 91 |
|
| 92 |
data.append({
|
| 93 |
"timestamp": timestamp,
|
|
|
|
| 109 |
def get_serialized_vtt(dicts):
|
| 110 |
output = "WebVTT\n\n"
|
| 111 |
for dic in dicts:
|
|
|
|
| 112 |
output += f'{dic["timestamp"]}\n'
|
| 113 |
output += f'{dic["sentence"]}\n\n'
|
| 114 |
return output
|