fixed a bug
This commit is contained in:
@@ -86,12 +86,28 @@ class VideoRepository:
|
||||
text TEXT,
|
||||
audio_filename TEXT NOT NULL,
|
||||
audio_size_bytes INTEGER NOT NULL,
|
||||
overall_score REAL NOT NULL DEFAULT 0,
|
||||
recognized_text TEXT NOT NULL DEFAULT '',
|
||||
FOREIGN KEY (share_id) REFERENCES dub_shares(share_id) ON DELETE CASCADE,
|
||||
UNIQUE (share_id, sentence_index)
|
||||
);
|
||||
"""
|
||||
)
|
||||
|
||||
with self._connect() as connection:
|
||||
columns = {
|
||||
row["name"]
|
||||
for row in connection.execute("PRAGMA table_info(dub_share_segments)")
|
||||
}
|
||||
if "overall_score" not in columns:
|
||||
connection.execute(
|
||||
"ALTER TABLE dub_share_segments ADD COLUMN overall_score REAL NOT NULL DEFAULT 0"
|
||||
)
|
||||
if "recognized_text" not in columns:
|
||||
connection.execute(
|
||||
"ALTER TABLE dub_share_segments ADD COLUMN recognized_text TEXT NOT NULL DEFAULT ''"
|
||||
)
|
||||
|
||||
def upsert_upload(
|
||||
self,
|
||||
*,
|
||||
@@ -312,8 +328,8 @@ class VideoRepository:
|
||||
"""
|
||||
INSERT INTO dub_share_segments (
|
||||
share_id, sentence_index, start_ms, end_ms, text,
|
||||
audio_filename, audio_size_bytes
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
audio_filename, audio_size_bytes, overall_score, recognized_text
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""",
|
||||
[
|
||||
(
|
||||
@@ -324,6 +340,8 @@ class VideoRepository:
|
||||
segment["text"],
|
||||
segment["audio_filename"],
|
||||
segment["audio_size_bytes"],
|
||||
segment.get("overall_score", 0),
|
||||
segment.get("recognized_text", ""),
|
||||
)
|
||||
for segment in segments
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user