feat: add DeepSeek subtitle AI workflow
This commit is contained in:
1 parent
bcebeaef82
commit
72072c884c
15 files changed
+710
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
|
||||
from backend.subtitle_tools import build_vtt, clean_english_subtitle
|
||||
|
||||
|
||||
def test_clean_english_subtitle_removes_empty_and_duplicate_cues():
|
||||
raw = """WEBVTT
|
||||
|
||||
00:00:00.000 --> 00:00:00.001
|
||||
|
||||
00:00:00.872 --> 00:00:04.959
|
||||
My first job as an investor
|
||||
was when I was 24 years old,
|
||||
|
||||
00:00:00.872 --> 00:00:04.959
|
||||
My first job as an investor
|
||||
was when I was 24 years old,
|
||||
"""
|
||||
|
||||
result = clean_english_subtitle(raw)
|
||||
|
||||
assert result.original_count == 3
|
||||
assert result.cleaned_count == 1
|
||||
assert result.duplicate_count == 1
|
||||
assert result.empty_count == 1
|
||||
assert result.cues[0].start == "00:00:00.872"
|
||||
assert result.cues[0].end == "00:00:04.959"
|
||||
assert result.cues[0].text == "My first job as an investor\nwas when I was 24 years old,"
|
||||
|
||||
|
||||
def test_build_vtt_outputs_numbered_blocks():
|
||||
result = build_vtt([
|
||||
{
|
||||
"start": "00:00:00.872",
|
||||
"end": "00:00:04.959",
|
||||
"text": "My first job as an investor",
|
||||
}
|
||||
])
|
||||
|
||||
assert result == "WEBVTT\n\n1\n00:00:00.872 --> 00:00:04.959\nMy first job as an investor\n"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_clean_english_subtitle_removes_empty_and_duplicate_cues()
|
||||
test_build_vtt_outputs_numbered_blocks()
|
||||
Reference in new issue
Block a user