feat(snapshot): refresh API video metadata; keep removed visible
入库 / 小时近新片 / 全量快照成功时以 view_detail 覆盖 title、duration、 pages、cover、bvid、up_*、pubdate 等接口字段,并照旧写七项快照。 原站失效仅标 removed,不删行、不空写元数据;列表与详情继续展示, 快照队列仍跳过 removed。
This commit is contained in:
1 parent
99b71c037c
commit
6c73904b25
8 files changed
+329
-34
No files matched your search
@@ -116,11 +116,37 @@ class LibraryService:
|
||||
if candidate is None:
|
||||
video = self.repo.get_video(aid)
|
||||
if video is not None:
|
||||
# 已在库:仍以接口为准刷新元数据(不重复建档)
|
||||
try:
|
||||
detail = self.read_provider.get().view_detail(aid=aid)
|
||||
except BilibiliError as exc:
|
||||
self._log("warning", "ingest.detail_failed", aid=aid, error=str(exc))
|
||||
return IngestResult(
|
||||
ok=True, aid=aid, state="exists",
|
||||
title=str(video.get("title") or ""),
|
||||
up_name=str(video.get("up_name") or ""),
|
||||
message="已在库,无需重复入库",
|
||||
)
|
||||
self.repo.refresh_video_metadata(
|
||||
aid=detail.aid,
|
||||
bvid=detail.bvid,
|
||||
title=detail.title,
|
||||
up_mid=detail.up_mid,
|
||||
up_name=detail.up_name,
|
||||
pubdate=detail.pubdate,
|
||||
duration=detail.duration,
|
||||
pages=detail.pages,
|
||||
cover=detail.cover,
|
||||
up_face=detail.up_face,
|
||||
now=self._now(),
|
||||
)
|
||||
self._write_snapshot(detail)
|
||||
self.repo.bump_cache_version("videos")
|
||||
return IngestResult(
|
||||
ok=True, aid=aid, state="exists",
|
||||
title=str(video.get("title") or ""),
|
||||
up_name=str(video.get("up_name") or ""),
|
||||
message="已在库,无需重复入库",
|
||||
title=detail.title,
|
||||
up_name=detail.up_name or "",
|
||||
message="已在库,已刷新元数据",
|
||||
)
|
||||
return IngestResult(
|
||||
ok=False, aid=aid, state="missing", message="候选不存在或已处理"
|
||||
|
||||
Reference in new issue
Block a user