feat(subtitles): connect M-Team search and download to online workflow

通过既有provider表复用M-Team站点适配器的凭据、UA和共享限流;搜索只返回稳定字幕ID,下载签名现场获取,沿用沙箱解析、写入历史与撤销。迁移0096扩展字幕来源,schema反射同步。独立测试库验证M-Team真实API形状与旧字幕来源。参考:MoviePilot v3.2.4 app/modules/indexer/spider/mtorrent.py。
This commit is contained in:
root committed 2026-11-06 00:09:56 +08:00
1 parent 7e4cdbf5ba
commit 173f2e24c9
6 files changed
+369 -8

No files matched your search

+2 -2
View File
@@ -17,7 +17,7 @@ export const SubtitleLanguage = z.enum([
]);
export type SubtitleLanguage = z.infer<typeof SubtitleLanguage>;
export const SubtitleExt = z.enum(["srt", "ass", "ssa", "vtt", "sub", "sbv"]);
export const SubtitleSource = z.enum(["upload", "subhd", "zimuku"]);
export const SubtitleSource = z.enum(["upload", "subhd", "zimuku", "mteam"]);
export type SubtitleSource = z.infer<typeof SubtitleSource>;
/** 可写字幕的视频(作品在媒体库里的视频位置) */
@@ -146,7 +146,7 @@ export const SubtitleWriteRow = z.object({
export const SubtitleWritesQuery = z.object({ entityId: Id });
export const SubtitleWritesResponse = z.object({ items: z.array(SubtitleWriteView) });
// ── 在线(字幕站:SubHD、字幕库) ──
// ── 在线(字幕站:SubHD、字幕库;已启用的 M-Team 站点) ──
export const SubtitleSearchRequest = z.object({
entityId: Id,
@@ -0,0 +1,22 @@
import type { Kysely } from "kysely";
import { execDdl, oneOf } from "../src/migration-helpers.ts";
// M-Team 字幕沿用字幕资产与可撤销历史,只扩展来源,不保存下载签名。
// biome-ignore lint/suspicious/noExplicitAny: 迁移不依赖应用表类型
export async function up(db: Kysely<any>): Promise<void> {
await execDdl(
db,
`alter table subtitle_write drop constraint subtitle_write_source_check;
alter table subtitle_write add constraint subtitle_write_source_check ${oneOf("source", ["upload", "subhd", "zimuku", "mteam"])};`,
);
}
// biome-ignore lint/suspicious/noExplicitAny: 同上
export async function down(db: Kysely<any>): Promise<void> {
// 有新来源的历史时拒绝回退,不删除记录或改写其来源。
await execDdl(
db,
`alter table subtitle_write drop constraint subtitle_write_source_check;
alter table subtitle_write add constraint subtitle_write_source_check ${oneOf("source", ["upload", "subhd", "zimuku"])};`,
);
}
+1 -1
View File
@@ -267,7 +267,7 @@ export type SubscriptionSeasonScope = "current_season" | "following_seasons";
export type SubscriptionOrigin = "user" | "agent" | "policy" | "import";
export type SubscriptionPriority = "immediate" | "tracking" | "new_work" | "upgrade";
export type SubscriptionStatus = "active" | "paused" | "pending" | "completed" | "cancelled";
export type SubtitleWriteSource = "upload" | "subhd" | "zimuku";
export type SubtitleWriteSource = "upload" | "subhd" | "zimuku" | "mteam";
export type TaskStatus = "pending" | "running" | "waiting" | "succeeded" | "failed" | "cancelled" | "dead";
export type TasksOpLedgerStatus = "started" | "succeeded";
export type TitleAliasKind = "original" | "translated" | "short" | "site_title" | "romanized" | "other";