feat(subtitles): 补字幕第 1 步——上传字幕 / zip,识别语言与季集,配对写入视频同目录,历史与撤销
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
feee481915
commit
ef29bd62ce
22 files changed
+1554
-2
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import type { Kysely } from "kysely";
|
||||
import { execDdl } from "../src/migration-helpers.ts";
|
||||
|
||||
// 补字幕(docs/plan/subtitles.md):每次写入一个字幕文件记一行,撤销时删文件、有备份就还原。
|
||||
// 写入的字幕同时登记为 media_asset(kind = subtitle)+ asset_location(sidecar_of_location_id 指向视频位置)。
|
||||
// biome-ignore lint/suspicious/noExplicitAny: 迁移不依赖应用表类型
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await execDdl(
|
||||
db,
|
||||
`create table if not exists subtitle_write (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
media_entity_id uuid not null references media_entity (id) on delete cascade,
|
||||
video_location_id uuid references asset_location (id) on delete set null,
|
||||
subtitle_asset_id uuid references media_asset (id) on delete set null,
|
||||
library_root_id uuid not null references library_root (id) on delete cascade,
|
||||
relative_path text not null,
|
||||
language text not null,
|
||||
source text not null check (source in ('upload', 'subhd', 'zimuku')),
|
||||
source_name text not null,
|
||||
source_ref text,
|
||||
backup_path text,
|
||||
actor text,
|
||||
created_at timestamptz not null default now(),
|
||||
undone_at timestamptz
|
||||
);
|
||||
create index if not exists subtitle_write_entity on subtitle_write (media_entity_id, created_at desc);`,
|
||||
);
|
||||
}
|
||||
// biome-ignore lint/suspicious/noExplicitAny: 同上
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await execDdl(db, "drop table if exists subtitle_write;");
|
||||
}
|
||||
Reference in new issue
Block a user