continue fixing

This commit is contained in:
2026-08-26 11:22:55 +08:00
parent a6297e2f9f
commit b1d3a3bd5a
5 changed files with 169 additions and 31 deletions

View File

@@ -88,6 +88,7 @@ class VideoRepository:
audio_size_bytes INTEGER NOT NULL,
overall_score REAL NOT NULL DEFAULT 0,
recognized_text TEXT NOT NULL DEFAULT '',
score_details TEXT NOT NULL DEFAULT '{}',
FOREIGN KEY (share_id) REFERENCES dub_shares(share_id) ON DELETE CASCADE,
UNIQUE (share_id, sentence_index)
);
@@ -107,6 +108,10 @@ class VideoRepository:
connection.execute(
"ALTER TABLE dub_share_segments ADD COLUMN recognized_text TEXT NOT NULL DEFAULT ''"
)
if "score_details" not in columns:
connection.execute(
"ALTER TABLE dub_share_segments ADD COLUMN score_details TEXT NOT NULL DEFAULT '{}'"
)
def upsert_upload(
self,
@@ -328,8 +333,9 @@ class VideoRepository:
"""
INSERT INTO dub_share_segments (
share_id, sentence_index, start_ms, end_ms, text,
audio_filename, audio_size_bytes, overall_score, recognized_text
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
audio_filename, audio_size_bytes, overall_score, recognized_text,
score_details
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""",
[
(
@@ -342,6 +348,7 @@ class VideoRepository:
segment["audio_size_bytes"],
segment.get("overall_score", 0),
segment.get("recognized_text", ""),
segment.get("score_details", "{}"),
)
for segment in segments
],