feat(metadata): apply language chain and queue full refresh on new entities (INT-3)
Entities created from TMDB candidates (subscription, search/TMDB preview, organize wizard) and manual assignment to an unregistered TMDB identity take title/overview from the metadata.languages chain at creation and enqueue refreshMetadata full=1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
fe05138c9c
commit
ed868f166e
5 files changed
+83
-8
No files matched your search
@@ -1,6 +1,11 @@
|
||||
import type { FilesEntityFromCandidateResult, FilesExternalCandidate } from "@umt/contracts";
|
||||
import type { Principal } from "../../http/auth.ts";
|
||||
import { CandidateError, createEntityFromTmdbCandidate } from "../sources-identity/service/entity-from-candidate.ts";
|
||||
import {
|
||||
CandidateError,
|
||||
createEntityFromTmdbCandidate,
|
||||
enqueueNewEntityRefresh,
|
||||
} from "../sources-identity/service/entity-from-candidate.ts";
|
||||
import { metadataLanguages } from "../sources-identity/service/metadata-rich.ts";
|
||||
import { actorOfP, FilesError, type FmDeps } from "./common.ts";
|
||||
import { audit } from "./ledger.ts";
|
||||
|
||||
@@ -18,8 +23,13 @@ export async function entityFromCandidate(
|
||||
ref: FilesExternalCandidate,
|
||||
): Promise<FilesEntityFromCandidateResult> {
|
||||
try {
|
||||
const r = await createEntityFromTmdbCandidate(d.ctx.db, d.tmdb, ref, actorOf(principal));
|
||||
if (r.created) await audit(d, principal, "entity_from_candidate", { ...ref, mediaEntityId: r.mediaEntityId });
|
||||
const languages = await metadataLanguages(d.ctx);
|
||||
const r = await createEntityFromTmdbCandidate(d.ctx.db, d.tmdb, ref, actorOf(principal), { languages });
|
||||
if (r.created) {
|
||||
await audit(d, principal, "entity_from_candidate", { ...ref, mediaEntityId: r.mediaEntityId });
|
||||
// 订阅建档 / 搜索建档 / 整理向导都走这里:建档即入队 full 刷新(每集信息、富字段)
|
||||
await enqueueNewEntityRefresh(d.ctx, r.mediaEntityId);
|
||||
}
|
||||
return r;
|
||||
} catch (e) {
|
||||
if (e instanceof CandidateError)
|
||||
|
||||
Reference in new issue
Block a user