fix: 文件与作品页的低优先级问题(FIX-7)
- 文件列表「主文件」只认视频扩展名(字幕自成资产时位置 is_primary 也为真) - 行内悬浮操作只在鼠标悬浮时出现,选中行不再常驻遮挡大小/时间 - 种子详情按识别状态说人话,解析结果 JSON 跟随技术信息默认收起 - 作品页空收录版本写「没设收录要求」,版本行写「库里有 N 个版本」 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
23bd8cfe45
commit
3c17fa3356
6 files changed
+48
-14
No files matched your search
@@ -375,7 +375,8 @@ export async function annotate(
|
||||
fileKind,
|
||||
status,
|
||||
escape: r.escape,
|
||||
asset: a?.link ?? null,
|
||||
// is_primary 是"资产的主位置",字幕等附属文件自成资产时也为 true;「主文件」只认视频扩展名(FIX-7)
|
||||
asset: a ? { ...a.link, isPrimary: a.link.isPrimary && fileKind === "video" } : null,
|
||||
download: dl ? { taskId: dl.taskId, status: dl.status, progress: dl.progress, hnr: dl.hnr } : null,
|
||||
media: a?.media ?? null,
|
||||
dirSummary: null,
|
||||
|
||||
@@ -78,6 +78,29 @@ describe.skipIf(skip)("files 浏览与守卫", () => {
|
||||
expect(dir.dirSummary).toMatchObject({ videoCount: 2, registeredCount: 1 });
|
||||
});
|
||||
|
||||
it("主文件只认视频:整理登记成独立资产的字幕(is_primary = true)不标主文件(FIX-7)", async () => {
|
||||
await mkdir(join(h.lib, "Sub (2014)"));
|
||||
await writeFile(join(h.lib, "Sub (2014)", "Sub (2014) - 1080p.mkv"), "video");
|
||||
await writeFile(join(h.lib, "Sub (2014)", "Sub (2014) - 1080p.chi.zh-cn.srt"), "1\n");
|
||||
const e = await seedEntity(h.db, { kind: "movie", title: "Sub", year: 2014 });
|
||||
const v = await seedAsset(h.db, h, { entityId: e, rel: "Sub (2014)/Sub (2014) - 1080p.mkv" });
|
||||
const srt = await seedAsset(h.db, h, {
|
||||
entityId: e,
|
||||
rel: "Sub (2014)/Sub (2014) - 1080p.chi.zh-cn.srt",
|
||||
kind: "subtitle",
|
||||
});
|
||||
// 与 organize.ts 一致:附属文件的资产位置也是该资产的主位置,并挂在视频位置下
|
||||
await h.db
|
||||
.updateTable("asset_location")
|
||||
.set({ is_primary: true, sidecar_of_location_id: v.locationId })
|
||||
.where("id", "=", srt.locationId)
|
||||
.execute();
|
||||
const r = await h.api("GET", `/files?${q({ root: h.libRoot, path: "Sub (2014)" })}`);
|
||||
const byName = Object.fromEntries(r.body.data.entries.map((x: { name: string }) => [x.name, x]));
|
||||
expect(byName["Sub (2014) - 1080p.mkv"].asset).toMatchObject({ isPrimary: true });
|
||||
expect(byName["Sub (2014) - 1080p.chi.zh-cn.srt"].asset).toMatchObject({ isPrimary: false });
|
||||
});
|
||||
|
||||
it("下载根:纳管下载中的内容标 downloading", async () => {
|
||||
const r = await h.api("GET", `/files?${q({ root: h.dlRoot })}`);
|
||||
const e = r.body.data.entries.find((x: { name: string }) => x.name === "Show.S01.1080p");
|
||||
|
||||
Reference in new issue
Block a user