Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

feat(review): detect incomplete video endcards

longmeidaocfbeae8876d1
diff --git a/README.md b/README.md
index 45ed94fdc..0c975b3e5 100644
--- a/README.md
+++ b/README.md
@@ -402,6 +402,13 @@ FC2 跨号检测只读既有评论收获和 ledger 媒体事实。所有等价
& .\.venv\Scripts\python.exe scripts\audit_fc2_similarity.py
```
+首尾帧出处审计必须点名资产或给正数 limit,避免误启动全库云盘读取。Windows 使用系统内置英语 OCR;证据帧、OCR sidecar、候选和健康报告都写在 `generated`,不会修改媒体、ledger 或更好版本目标:
+
+```powershell
+# 已知回归样本;批准仍只记录复核决定
+& .\.venv\Scripts\python.exe scripts\audit_video_endcards.py --asset 13724
+```
+
历史创作者投影使用逐项只读审计,不再把目录名直接当身份:
```powershell
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index 4c2ce4bac..065bbaba2 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -70,7 +70,7 @@
- 语料边界(成年人、角色扮演标签、营销来源词)以 `AGENTS.md` 的那一条为准,本文件不复制第二份。
- 不从人脸识别私人真实身份。持久归属必须有番号、文件名、水印、厂牌、公开链接等非人脸证据。
- 删除和其他不可逆/对外动作先生成带证据和置信度的复核产物,执行步骤单独授权。
-- 单帧逐条判断、过暗/模糊画面、仅靠文件名区分片源水印与广告都属于弱项,应降低置信度或补抽帧,不应伪装成确定事实。
+- 单帧逐条判断、过暗/模糊画面、仅靠文件名区分片源水印与广告都属于弱项,应降低置信度或补抽帧,不应伪装成确定事实。`audit_video_endcards.py` 必须点名 asset 或给正数 limit,使用 Peach FFmpeg 有界抽首尾帧;Windows OCR 走 PowerShell 5.1 的 `Windows.Media.Ocr`,每张图片单独以 `-File` 传参,禁止把路径拼进 `-Command`。帧与 OCR sidecar 只进 `generated/endcard-evidence`,`Full version available` 和来源 URL/handle 只生成 `/review` 候选,不自动写 quality goal 或 ledger。
## 只存在于聊天中的结论等于不存在
diff --git a/docs/PRODUCT_BACKLOG.md b/docs/PRODUCT_BACKLOG.md
index e6755d2fd..2900d5979 100644
--- a/docs/PRODUCT_BACKLOG.md
+++ b/docs/PRODUCT_BACKLOG.md
@@ -2,22 +2,22 @@
更新时间:2026-08-25。这里只记录尚未完成或只完成一部分的需求;运行数字仍以 `docs/STATUS.md` 自动区块为准。
-## 已有骨架、尚未完成(4 项)
+## 已有骨架、尚未完成(5 项)
1. **Mix / 合集 / 播放列表**:自动 Mix 已混排进普通视频流,点击后使用独立 `/mix/{seed}/{item}` 路由并在播放器右侧显示当前队列;仍缺可命名、排序、保存、续播、编辑的持久播放列表,以及保存自动 Mix 的能力。
2. **寻找更好版本**:已经能逐条标记「高清 / 无水印 / 完整版」等目标;后续仍需相似内容匹配、候选去重、来源发现和人工替换确认。
3. **现代自适应播放**:Video.js、Range、统计面板和面向 115/PikPak 原生 MP4 的按需 HLS 清单已经上线;自适应码率、多路清单、快速首帧和来源层大块预取优化仍未完成。
4. **在线追更**:已有 RSS/Atom adapter、条件请求和快照存储;真实订阅源、调度、审核写入和 UI 尚未接通。
+5. **首尾帧出处与不完整候选**:已有受限 FFmpeg 首尾抽帧、Windows 内置 OCR、证据帧缓存、来源/Full version 候选和 `/review`;仍需决定全库批次范围,并把用户批准后的不完整版判断接到更好版本目标。
-## 尚未实现(8 项)
+## 尚未实现(7 项)
1. AI Provider 的真实调用、能力协商、Credential Manager 凭据和候选审核 UI。
2. 剩余厂牌 Logo 补齐与持续校验。
3. 剩余单一创作者风格板复核、无标签内容补标。
-4. 开头/结尾额外抽帧、片尾出处 OCR、「Full version」不完整候选。
-5. 缺时长资源补 probe 后再生成接触表。
-6. PikPak 计费抽样与下载边缘质量核验。
-7. Stash CommunityScrapers 的协议复用与元数据导入。
-8. 剩余 status / suggest / ledger 逻辑移入应用边界后删除旧 CLI 表面。
+4. 缺时长资源补 probe 后再生成接触表。
+5. PikPak 计费抽样与下载边缘质量核验。
+6. Stash CommunityScrapers 的协议复用与元数据导入。
+7. 剩余 status / suggest / ledger 逻辑移入应用边界后删除旧 CLI 表面。
-合计:**12 项开放需求**,其中 4 项已有骨架,8 项尚未实现。头像人脸取景(2026-08-22 上线,见 STATUS)和 115 大小写路径失败(2026-08-17/18 收尾,2 条失败已定因)已完成,不再计入。本轮设置、5 分钟刷新、搜索历史、播放器统计、动态环境光和 Shorts 风格沉浸模式不再计入开放需求。
+合计:**12 项开放需求**,其中 5 项已有骨架,7 项尚未实现。头像人脸取景(2026-08-22 上线,见 STATUS)和 115 大小写路径失败(2026-08-17/18 收尾,2 条失败已定因)已完成,不再计入。本轮设置、5 分钟刷新、搜索历史、播放器统计、动态环境光和 Shorts 风格沉浸模式不再计入开放需求。
diff --git a/docs/REUSE.md b/docs/REUSE.md
index eafaf1c14..1301f7c62 100644
--- a/docs/REUSE.md
+++ b/docs/REUSE.md
@@ -39,7 +39,7 @@
| 生成产物跨机同步 | Syncthing 2.1.x,Windows send-only → Mac receive-only | 目录划分、忽略规则、方向固定与「Mac 不发布正式产物」的边界 |
| Windows 托盘 | pystray 0.19.5(LGPLv3)、Pillow、Win32 Per-Monitor V2 DPI | Peach 服务归属、后台更新检查、菜单动作、品牌图标 |
| 智能体用量/配额 | Provider 官方配额接口;T3 Code/CodexBar 提供本地历史 | 任务路由、脱敏、过期快照标记 |
-| 视频出处/片尾证据 | 现有 FFmpeg 抽帧 + 经复核的 OCR/视觉适配器 | 首尾采样策略、来源、不完整版候选 |
+| 视频出处/片尾证据 | 现有 FFmpeg 抽帧 + Windows.Media.Ocr WinRT Provider(Windows PowerShell 5.1 固定适配器) | 有界首尾采样、缓存、来源/Full version 分类、健康统计与人工复核 |
| 参考产品行为 | 当前线上交互 + 有版本的公开 DOM/CSS/JS;取不到源码时用精确截图测量 | 证据登记、无障碍、Peach 差异、回归检查 |
依赖的第一个消费者及其隔离测试必须在同一改动落地,否则不引入依赖。
diff --git a/docs/STATUS.md b/docs/STATUS.md
index 17e441edb..1f2f4d1d7 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -196,7 +196,7 @@
1. 创作者板的机械识别已做完:`creator-tags-review.csv` 里 42 条 pending 全部产出 candidate(34 candidate、8 skip,见 `creator-tags-candidate-20260817.csv`),没有未覆盖的板。剩下的是用户在 `/review` 页面逐条复核,点「通过」才写 `asset_tag/asset_entity`。注意天花板:全库 7,622 条无标签视频里创作者板最多覆盖约 2,800 条,其余既无创作者也无有效番号(384 个 FC2 + 约 330 个 `WX` 业余码,三源实测零命中)。
2. FC2 评论标记与跨号相似分别在 `/review` 的 `fc2_markings`、`fc2_similarity` 层逐条复核。匿名评论一律不自动升级;库外 video_id 保留 evidence 等待入库。仍未做的是把复核通过的演员写进 `entity`/`asset_entity`,以及由用户决定后执行实际跨号关系写入。
-3. 首尾帧额外抽样:识别水印、出处和 `full version available`,生成带证据的「不完整版/剪辑版」候选。首个回归样本为 115 的 `04_Stepsistercaughtmejerkingoff,deepthroat,throatpie.mp4` 片尾。
+3. 首尾帧出处 P3 已形成最小闭环:`audit_video_endcards.py` 默认拒绝无界全库运行,按 asset/limit 使用 Peach FFmpeg 抽首尾帧,Windows 内置英语 OCR 识别来源 URL、handle 和 `Full version available`,帧/OCR sidecar 可续用,并产候选与健康 CSV;`/review` 的「片尾/出处证据」同时显示证据帧和原视频,批准只记录决定。真实 115 回归 asset `13724` 在 505.607 秒识别出 `Full version available on: fansly.com/smuzililpussy`,两帧 OCR 成功、错误 0,ledger/quality goal/复核决定均不变。未做全库批次,也未把判断自动写成更好版本目标。
4. 继续人工补齐姓名审计留下的 35 位未解析发行女优;这些多为艺名、账号式拼写或上游未收录,现状刻意保留原名,不能为追求“全中文”而猜译。头像仍有 15 位图库未收录、5 位所有候选不过质量门槛;姓名与头像进度不得再互相阻塞。
5. 通过官方/公开来源补齐 86 个厂牌 Logo,保留来源和质量门槛。Logo 与头像的取源方向相反:头像应取整理好的图库,Logo 是品牌标识,官网与维基才是权威来源。
6. Windows writer 执行 PikPak 视觉夜跑:先用 `probe.py --redo all` 重探当前 5,445 条失败/零时长,再只跑官方封套与九帧缩略图。generation 29 的 Mac 副本基线为可直接抽 4,740、需重探 5,445、短于等于 2 秒 11;Windows 起跑前重算。第一晚以 200 GB 流量守卫与 40 GiB 系统盘闸门为硬上限,允许安全中止和续跑,不承诺一夜全量完成。
diff --git a/scripts/audit_video_endcards.py b/scripts/audit_video_endcards.py
new file mode 100644
index 000000000..f80769f8c
--- /dev/null
+++ b/scripts/audit_video_endcards.py
@@ -0,0 +1,371 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+r"""只读抽取视频首尾帧并生成片尾出处/不完整版候选。
+
+帧和 OCR sidecar 只写 generated/endcard-evidence;ledger、媒体文件、quality goal 与复核决定
+都不写。默认必须点名 --asset 或给正数 --limit,避免无意启动全库云盘批处理。
+"""
+from __future__ import annotations
+
+import argparse
+import csv
+import json
+import os
+import sqlite3
+import subprocess
+import time
+import urllib.parse
+from datetime import datetime
+from pathlib import Path
+from typing import Callable
+
+from peach.config import DATABASE_PATH, FFMPEG_DIR, GENERATED_DIR, STATE_DIR
+from peach.endcard import POLICY_VERSION, detect_endcard
+from peach.ffmpeg import FFmpegResolver
+from peach.jobs import (
+ DiskGuard,
+ JobPolicyError,
+ PidFileLock,
+ SourceAccessPolicy,
+ require_free_space,
+)
+from peach.media import resolve_case_insensitive
+from peach.platform import system_volume
+
+
+CANDIDATE_FIELDS = (
+ "candidate_key", "asset_id", "name", "code", "location", "sample_kind",
+ "timestamp_seconds", "frame_key", "ocr_text", "verdict", "detected_urls",
+ "detected_handles", "confidence", "reason", "policy_version", "status",
+)
+HEALTH_FIELDS = (
+ "source", "policy_version", "attempted", "frames_requested", "frame_cache_reused",
+ "captured", "capture_errors", "ocr_cache_reused", "ocr_succeeded", "ocr_errors",
+ "candidates", "incomplete_candidates", "source_evidence", "elapsed_ms",
+ "last_error_kind", "last_error_message",
+)
+
+
+def build_parser() -> argparse.ArgumentParser:
+ stamp = datetime.now().strftime("%Y%m%d-%H%M%S")
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--db", type=Path, default=DATABASE_PATH)
+ parser.add_argument("--asset", type=int, action="append")
+ parser.add_argument("--location")
+ parser.add_argument("--limit", type=int, default=0)
+ parser.add_argument("--allow-metered", action="store_true")
+ parser.add_argument("--head-offsets", default="0.5,2,5")
+ parser.add_argument("--tail-offsets", default="0.5,2,5,10,15")
+ parser.add_argument("--min-free", type=float, default=40.0)
+ parser.add_argument(
+ "--evidence-root", type=Path, default=GENERATED_DIR / "endcard-evidence",
+ )
+ parser.add_argument(
+ "--out", type=Path,
+ default=GENERATED_DIR / f"video-endcard-candidate-{stamp}.csv",
+ )
+ parser.add_argument(
+ "--health", type=Path,
+ default=GENERATED_DIR / f"video-endcard-health-{stamp}.csv",
+ )
+ parser.add_argument(
+ "--ocr-script", type=Path,
+ default=Path(__file__).resolve().with_name("windows_ocr.ps1"),
+ )
+ parser.add_argument("--lock", type=Path, default=STATE_DIR / ".endcard-audit.lock")
+ return parser
+
+
+def parse_offsets(raw: str) -> tuple[float, ...]:
+ try:
+ values = tuple(dict.fromkeys(float(value.strip()) for value in raw.split(",")))
+ except ValueError as error:
+ raise ValueError("抽帧偏移必须是逗号分隔的秒数") from error
+ if not values or any(value <= 0 for value in values):
+ raise ValueError("抽帧偏移必须全部大于 0")
+ return values
+
+
+def sample_points(
+ duration: float, head_offsets: tuple[float, ...], tail_offsets: tuple[float, ...],
+) -> list[tuple[str, float]]:
+ points: list[tuple[str, float]] = []
+ seen: set[int] = set()
+ for kind, offsets in (("head", head_offsets), ("tail", tail_offsets)):
+ for offset in offsets:
+ timestamp = offset if kind == "head" else duration - offset
+ millis = round(timestamp * 1000)
+ if timestamp <= 0 or timestamp >= duration or millis in seen:
+ continue
+ seen.add(millis)
+ points.append((kind, timestamp))
+ return points
+
+
+def open_readonly(database: Path) -> sqlite3.Connection:
+ uri = "file:" + urllib.parse.quote(database.resolve().as_posix()) + "?mode=ro"
+ connection = sqlite3.connect(uri, uri=True)
+ connection.row_factory = sqlite3.Row
+ return connection
+
+
+def load_assets(args: argparse.Namespace) -> list[dict]:
+ if not args.asset and args.limit <= 0:
+ raise ValueError("必须点名 --asset,或给正数 --limit 才会启动")
+ source_sql, source_parameters = SourceAccessPolicy().sql_filter(
+ args.location, args.allow_metered,
+ )
+ sql = (
+ "SELECT id,location,path,name,code,duration,size FROM asset "
+ "WHERE medium='video' AND location<>'online' AND duration>2"
+ + source_sql
+ )
+ parameters: tuple[object, ...] = source_parameters
+ if args.asset:
+ marks = ",".join("?" for _ in args.asset)
+ sql += f" AND id IN ({marks})"
+ parameters += tuple(args.asset)
+ sql += " ORDER BY size DESC,id"
+ if args.limit > 0:
+ sql += " LIMIT ?"
+ parameters += (args.limit,)
+ connection = open_readonly(args.db)
+ try:
+ return [dict(row) for row in connection.execute(sql, parameters)]
+ finally:
+ connection.close()
+
+
+def frame_path(root: Path, asset_id: int, kind: str, timestamp: float) -> Path:
+ return root / str(asset_id) / f"{kind}-{round(timestamp * 1000):09d}.png"
+
+
+def capture_frame(ffmpeg: str, source: str, timestamp: float, destination: Path) -> bool:
+ destination.parent.mkdir(parents=True, exist_ok=True)
+ temporary = destination.with_name(f".{destination.name}.{os.getpid()}.tmp.png")
+ command = [
+ ffmpeg, "-y", "-v", "error", "-rw_timeout", "8000000",
+ "-ss", f"{timestamp:.3f}", "-i", source, "-frames:v", "1",
+ "-vf", "scale=1280:-1", str(temporary),
+ ]
+ try:
+ completed = subprocess.run(command, capture_output=True, timeout=45)
+ if completed.returncode != 0 or not temporary.is_file() or temporary.stat().st_size <= 1024:
+ return False
+ os.replace(temporary, destination)
+ return True
+ except (OSError, subprocess.TimeoutExpired):
+ return False
+ finally:
+ temporary.unlink(missing_ok=True)
+
+
+class WindowsOcrProvider:
+ def __init__(self, script: Path):
+ self.script = script
+ self.powershell = Path(os.environ.get("SystemRoot", r"C:\Windows")) / (
+ r"System32\WindowsPowerShell\v1.0\powershell.exe"
+ )
+
+ def recognize(self, paths: list[Path]) -> dict[str, dict]:
+ if os.name != "nt" or not self.powershell.is_file() or not self.script.is_file():
+ raise RuntimeError("Windows OCR provider unavailable")
+ results: dict[str, dict] = {}
+ # Windows PowerShell 5.1 对命令行 string[] 的绑定有歧义:第二个裸路径会被
+ # 绑定到后面的 Language。逐张调用固定 -File 虽有少量启动成本,但路径不会
+ # 被拼进脚本文本,也不会串到别的参数。
+ for path in paths:
+ command = [
+ str(self.powershell), "-NoProfile", "-ExecutionPolicy", "Bypass",
+ "-File", str(self.script), "-Paths", str(path.resolve()),
+ ]
+ completed = subprocess.run(
+ command, capture_output=True, text=True, encoding="utf-8",
+ errors="replace", timeout=30,
+ )
+ if completed.returncode != 0:
+ raise RuntimeError((completed.stderr or completed.stdout or "OCR failed")[-800:])
+ try:
+ payload = json.loads(completed.stdout.lstrip("\ufeff"))
+ except ValueError as error:
+ raise RuntimeError("Windows OCR returned invalid JSON") from error
+ for row in payload:
+ results[str(Path(row["path"]).resolve())] = row
+ return results
+
+
+def atomic_json(path: Path, payload: dict) -> None:
+ temporary = path.with_name(f".{path.name}.{os.getpid()}.tmp")
+ try:
+ temporary.write_text(
+ json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8",
+ )
+ os.replace(temporary, path)
+ except BaseException:
+ temporary.unlink(missing_ok=True)
+ raise
+
+
+def atomic_csv(path: Path, fields: tuple[str, ...], rows: list[dict]) -> None:
+ path.parent.mkdir(parents=True, exist_ok=True)
+ temporary = path.with_name(f".{path.name}.{os.getpid()}.tmp")
+ try:
+ with temporary.open("w", encoding="utf-8-sig", newline="") as handle:
+ writer = csv.DictWriter(handle, fieldnames=fields)
+ writer.writeheader()
+ for row in rows:
+ writer.writerow({field: row.get(field, "") for field in fields})
+ os.replace(temporary, path)
+ except BaseException:
+ temporary.unlink(missing_ok=True)
+ raise
+
+
+def run(
+ args: argparse.Namespace,
+ *,
+ capture: Callable[[str, str, float, Path], bool] = capture_frame,
+ ocr=None,
+ ffmpeg_path: str | None = None,
+) -> int:
+ started = time.perf_counter()
+ health = {
+ "source": "ffmpeg+windows_ocr", "policy_version": POLICY_VERSION,
+ "attempted": 0, "frames_requested": 0, "frame_cache_reused": 0,
+ "captured": 0, "capture_errors": 0, "ocr_cache_reused": 0,
+ "ocr_succeeded": 0, "ocr_errors": 0, "candidates": 0,
+ "incomplete_candidates": 0, "source_evidence": 0, "elapsed_ms": 0,
+ "last_error_kind": "", "last_error_message": "",
+ }
+ try:
+ assets = load_assets(args)
+ head = parse_offsets(args.head_offsets)
+ tail = parse_offsets(args.tail_offsets)
+ require_free_space(system_volume(), args.min_free)
+ guard = DiskGuard(system_volume(), args.min_free, 0)
+ if ffmpeg_path is None:
+ resolver = FFmpegResolver(FFMPEG_DIR)
+ ffmpeg = resolver.ffmpeg()
+ if ffmpeg is None:
+ raise RuntimeError("ffmpeg unavailable")
+ active_ffmpeg = str(ffmpeg.path)
+ else:
+ active_ffmpeg = ffmpeg_path
+ provider = ocr or WindowsOcrProvider(args.ocr_script)
+ observations: dict[int, list[dict]] = {int(asset["id"]): [] for asset in assets}
+ uncached: list[Path] = []
+ frame_context: dict[str, tuple[dict, str, float, Path]] = {}
+ for asset in assets:
+ health["attempted"] += 1
+ for kind, timestamp in sample_points(float(asset["duration"]), head, tail):
+ health["frames_requested"] += 1
+ guard.check(force=True)
+ frame = frame_path(args.evidence_root, int(asset["id"]), kind, timestamp)
+ sidecar = frame.with_suffix(".ocr.json")
+ if frame.is_file() and frame.stat().st_size > 1024:
+ health["frame_cache_reused"] += 1
+ else:
+ ok = capture(
+ active_ffmpeg, resolve_case_insensitive(asset["path"]),
+ timestamp, frame,
+ )
+ if not ok:
+ health["capture_errors"] += 1
+ continue
+ health["captured"] += 1
+ key = str(frame.resolve())
+ frame_context[key] = (asset, kind, timestamp, sidecar)
+ if sidecar.is_file():
+ try:
+ result = json.loads(sidecar.read_text(encoding="utf-8"))
+ except (OSError, ValueError):
+ uncached.append(frame)
+ else:
+ observations[int(asset["id"])].append({
+ "asset": asset, "kind": kind, "timestamp": timestamp,
+ "frame": frame, **result,
+ })
+ health["ocr_cache_reused"] += 1
+ else:
+ uncached.append(frame)
+ if uncached:
+ results = provider.recognize(uncached)
+ for frame in uncached:
+ key = str(frame.resolve())
+ asset, kind, timestamp, sidecar = frame_context[key]
+ result = results.get(key) or {"text": "", "lines": [], "error": "missing OCR row"}
+ atomic_json(sidecar, result)
+ observations[int(asset["id"])].append({
+ "asset": asset, "kind": kind, "timestamp": timestamp,
+ "frame": frame, **result,
+ })
+ if result.get("error"):
+ health["ocr_errors"] += 1
+ health["last_error_kind"] = "ocr_item"
+ health["last_error_message"] = str(result["error"])[:500]
+ else:
+ health["ocr_succeeded"] += 1
+ candidates = []
+ priority = {"incomplete_candidate": 2, "source_evidence": 1, "none": 0}
+ for asset_id, rows in observations.items():
+ classified = [(detect_endcard(row.get("text") or ""), row) for row in rows]
+ classified = [item for item in classified if item[0].verdict != "none"]
+ if not classified:
+ continue
+ detection, evidence = max(
+ classified,
+ key=lambda item: (priority[item[0].verdict], item[0].confidence,
+ item[1]["kind"] == "tail", item[1]["timestamp"]),
+ )
+ asset = evidence["asset"]
+ candidates.append({
+ "candidate_key": str(asset_id), "asset_id": asset_id,
+ "name": asset.get("name") or "", "code": asset.get("code") or "",
+ "location": asset.get("location") or "", "sample_kind": evidence["kind"],
+ "timestamp_seconds": round(float(evidence["timestamp"]), 3),
+ "frame_key": str(evidence["frame"].relative_to(args.evidence_root)).replace("\\", "/"),
+ "ocr_text": str(evidence.get("text") or "")[:2000],
+ "verdict": detection.verdict,
+ "detected_urls": " ".join(detection.urls),
+ "detected_handles": " ".join(detection.handles),
+ "confidence": detection.confidence, "reason": detection.reason,
+ "policy_version": POLICY_VERSION, "status": "candidate",
+ })
+ candidates.sort(key=lambda row: (-float(row["confidence"]), int(row["asset_id"])))
+ health["candidates"] = len(candidates)
+ health["incomplete_candidates"] = sum(
+ row["verdict"] == "incomplete_candidate" for row in candidates
+ )
+ health["source_evidence"] = sum(
+ row["verdict"] == "source_evidence" for row in candidates
+ )
+ atomic_csv(args.out, CANDIDATE_FIELDS, candidates)
+ except (OSError, sqlite3.Error, subprocess.SubprocessError, ValueError, RuntimeError,
+ JobPolicyError) as error:
+ health["last_error_kind"] = type(error).__name__
+ health["last_error_message"] = str(error)[:500]
+ health["elapsed_ms"] = round((time.perf_counter() - started) * 1000)
+ atomic_csv(args.health, HEALTH_FIELDS, [health])
+ print(f"首尾帧审计失败:{error}")
+ print(f"健康报告 → {args.health}")
+ return getattr(error, "exit_code", 2)
+ health["elapsed_ms"] = round((time.perf_counter() - started) * 1000)
+ atomic_csv(args.health, HEALTH_FIELDS, [health])
+ print(f"首尾帧候选 {health['candidates']} 条 → {args.out}")
+ print(f"来源健康 → {args.health}")
+ print("只生成候选:未修改 ledger、quality goal、媒体文件或复核决定。")
+ return 0
+
+
+def main(argv: list[str] | None = None) -> int:
+ args = build_parser().parse_args(argv)
+ try:
+ with PidFileLock(args.lock):
+ return run(args)
+ except JobPolicyError as error:
+ print(f"[stop] {error}")
+ return error.exit_code
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/scripts/windows_ocr.ps1 b/scripts/windows_ocr.ps1
new file mode 100644
index 000000000..d4ac6e23c
--- /dev/null
+++ b/scripts/windows_ocr.ps1
@@ -0,0 +1,86 @@
+param(
+ [Parameter(Mandatory = $true)]
+ [string[]]$Paths,
+ [string]$Language = "en-US"
+)
+
+$ErrorActionPreference = "Stop"
+[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
+Add-Type -AssemblyName System.Runtime.WindowsRuntime
+$null = [Windows.Storage.StorageFile, Windows.Storage, ContentType = WindowsRuntime]
+$null = [Windows.Storage.Streams.IRandomAccessStream, Windows.Storage.Streams, ContentType = WindowsRuntime]
+$null = [Windows.Graphics.Imaging.BitmapDecoder, Windows.Graphics.Imaging, ContentType = WindowsRuntime]
+$null = [Windows.Graphics.Imaging.SoftwareBitmap, Windows.Graphics.Imaging, ContentType = WindowsRuntime]
+$null = [Windows.Media.Ocr.OcrEngine, Windows.Foundation, ContentType = WindowsRuntime]
+$null = [Windows.Media.Ocr.OcrResult, Windows.Foundation, ContentType = WindowsRuntime]
+$null = [Windows.Globalization.Language, Windows.Foundation, ContentType = WindowsRuntime]
+
+$peachAsTask = [System.WindowsRuntimeSystemExtensions].GetMethods() |
+ Where-Object {
+ $_.Name -eq "AsTask" -and $_.IsGenericMethod -and
+ $_.GetParameters().Count -eq 1
+ } |
+ Select-Object -First 1
+
+function Wait-PeachWinRt {
+ param($Operation, [Type]$ResultType)
+ $peachTask = $peachAsTask.MakeGenericMethod($ResultType).Invoke($null, @($Operation))
+ try {
+ $peachTask.Wait()
+ }
+ catch {
+ $peachInner = $peachTask.Exception
+ while ($peachInner.InnerException) { $peachInner = $peachInner.InnerException }
+ throw $peachInner
+ }
+ return $peachTask.Result
+}
+
+$peachLanguage = New-Object Windows.Globalization.Language $Language
+$peachEngine = [Windows.Media.Ocr.OcrEngine]::TryCreateFromLanguage($peachLanguage)
+if ($null -eq $peachEngine) {
+ throw "Windows OCR language unavailable: $Language"
+}
+
+$peachResults = foreach ($peachPath in $Paths) {
+ $peachStream = $null
+ $peachBitmap = $null
+ try {
+ $peachFullPath = [System.IO.Path]::GetFullPath($peachPath)
+ $peachFile = Wait-PeachWinRt (
+ [Windows.Storage.StorageFile]::GetFileFromPathAsync($peachFullPath)
+ ) ([Windows.Storage.StorageFile])
+ $peachStream = Wait-PeachWinRt (
+ $peachFile.OpenAsync([Windows.Storage.FileAccessMode]::Read)
+ ) ([Windows.Storage.Streams.IRandomAccessStream])
+ $peachDecoder = Wait-PeachWinRt (
+ [Windows.Graphics.Imaging.BitmapDecoder]::CreateAsync($peachStream)
+ ) ([Windows.Graphics.Imaging.BitmapDecoder])
+ $peachBitmap = Wait-PeachWinRt (
+ $peachDecoder.GetSoftwareBitmapAsync()
+ ) ([Windows.Graphics.Imaging.SoftwareBitmap])
+ $peachRecognized = Wait-PeachWinRt (
+ $peachEngine.RecognizeAsync($peachBitmap)
+ ) ([Windows.Media.Ocr.OcrResult])
+ [pscustomobject]@{
+ path = $peachFullPath
+ text = $peachRecognized.Text
+ lines = @($peachRecognized.Lines | ForEach-Object { $_.Text })
+ error = ""
+ }
+ }
+ catch {
+ [pscustomobject]@{
+ path = $peachPath
+ text = ""
+ lines = @()
+ error = $_.Exception.Message
+ }
+ }
+ finally {
+ if ($null -ne $peachBitmap) { $peachBitmap.Dispose() }
+ if ($null -ne $peachStream) { $peachStream.Dispose() }
+ }
+}
+
+ConvertTo-Json -InputObject @($peachResults) -Compress -Depth 4
diff --git a/src/peach/api.py b/src/peach/api.py
index 9e20c0b60..f7fdea7b8 100644
--- a/src/peach/api.py
+++ b/src/peach/api.py
@@ -600,6 +600,23 @@ def create_app(
response.headers["Cache-Control"] = "public, max-age=86400"
return response
+ @app.api_route("/endcard-frame", methods=["GET", "HEAD"])
+ def endcard_frame(request: Request, id: int, name: str):
+ """Serve only generated OCR evidence frames, never a client-provided path."""
+ args = _first_query_values(request)
+ if not _authorized(request, settings.token, args):
+ return JSONResponse({"error": "unauthorized"}, status_code=401)
+ if (id <= 0 or not name.endswith(".png") or "/" in name or "\\" in name
+ or name.startswith(".")):
+ return JSONResponse({"error": "invalid frame"}, status_code=400)
+ root = (settings.candidate_root / "endcard-evidence" / str(id)).resolve()
+ path = (root / name).resolve()
+ if path.parent != root or not path.is_file():
+ return JSONResponse({"error": "no frame"}, status_code=404)
+ response = FileResponse(path, media_type="image/png")
+ response.headers["Cache-Control"] = "private, max-age=86400"
+ return response
+
@app.api_route("/avatar", methods=["GET", "HEAD"])
def avatar(request: Request, id: int):
args = _first_query_values(request)
diff --git a/src/peach/endcard.py b/src/peach/endcard.py
new file mode 100644
index 000000000..a885f65e0
--- /dev/null
+++ b/src/peach/endcard.py
@@ -0,0 +1,64 @@
+"""Pure OCR classification for video opening/end-card evidence."""
+from __future__ import annotations
+
+import re
+from dataclasses import dataclass
+
+
+POLICY_VERSION = "video-endcard-policy-v1"
+FULL_VERSION = re.compile(
+ r"\bfull\s+version\s+(?:is\s+)?available(?:\s+on)?\b",
+ re.IGNORECASE,
+)
+DOMAIN = re.compile(
+ r"\b(?:https?://)?(?:www\.)?([a-z0-9][a-z0-9-]{1,62}\.(?:com|net|org|tv|cc|me))"
+ r"(?:[/\s]+([a-z0-9_.-]{2,64}))?",
+ re.IGNORECASE,
+)
+HANDLE = re.compile(r"(?<![\w@])@([a-z0-9_]{3,32})\b", re.IGNORECASE)
+CREATOR_PLATFORMS = {
+ "fansly.com", "onlyfans.com", "fanvue.com", "manyvids.com", "patreon.com",
+}
+
+
+@dataclass(frozen=True)
+class EndcardDetection:
+ verdict: str
+ full_version: bool
+ urls: tuple[str, ...]
+ handles: tuple[str, ...]
+ confidence: float
+ reason: str
+
+
+def normalize_ocr(text: str) -> str:
+ return re.sub(r"\s+", " ", str(text or "")).strip()
+
+
+def detect_endcard(text: str) -> EndcardDetection:
+ normalized = normalize_ocr(text)
+ full_version = bool(FULL_VERSION.search(normalized))
+ urls = []
+ for match in DOMAIN.finditer(normalized):
+ domain = match.group(1).lower()
+ suffix = (match.group(2) or "").strip("./")
+ value = domain + (f"/{suffix}" if suffix else "")
+ if value not in urls:
+ urls.append(value)
+ handles = tuple(dict.fromkeys(match.group(1) for match in HANDLE.finditer(normalized)))
+ creator_source = any(url.split("/", 1)[0] in CREATOR_PLATFORMS for url in urls)
+ if full_version:
+ confidence = 0.98 if creator_source else 0.9
+ reason = "片尾明确写有 Full version available"
+ if urls:
+ reason += ";来源 " + "、".join(urls)
+ return EndcardDetection(
+ "incomplete_candidate", True, tuple(urls), handles, confidence, reason,
+ )
+ if urls or handles:
+ evidence = [*urls, *(f"@{handle}" for handle in handles)]
+ return EndcardDetection(
+ "source_evidence", False, tuple(urls), handles, 0.72,
+ "画面出现来源/水印:" + "、".join(evidence),
+ )
+ return EndcardDetection("none", False, (), (), 0.0, "")
diff --git a/src/peach/web_contract.py b/src/peach/web_contract.py
index ec4ee5452..4af79f3ea 100644
--- a/src/peach/web_contract.py
+++ b/src/peach/web_contract.py
@@ -1076,6 +1076,7 @@ CANDIDATE_PREFIX = {
"cover_sources": "cover-fetch-log",
"fc2_markings": "fc2-candidate-log",
"fc2_similarity": "fc2-similarity-candidate-",
+ "video_endcards": "video-endcard-candidate-",
}
# 每类候选的稳定主键列。缺这一列的行直接跳过并计数,绝不退化成行号——
# 行号会在 CSV 重排后把历史决定悄悄挪到别的条目上。
@@ -1089,6 +1090,7 @@ CANDIDATE_KEY = {
"cover_sources": "code",
"fc2_markings": "code",
"fc2_similarity": "pair_key",
+ "video_endcards": "candidate_key",
}
def _needs_review(category: str, row: dict) -> bool:
"""已经有定论的行不该占复核页。
@@ -1226,17 +1228,22 @@ def _attach_review_asset_context(connection, rows: list[dict]) -> None:
):
assets_by_entity.setdefault(asset["entity_id"], dict(asset))
+ explicit_ids = {
+ int(row["asset_id"]) for row in rows
+ if str(row.get("asset_id") or "").isdigit()
+ }
comparison_ids = {
int(value) for row in rows
for value in (row.get("left_asset_id"), row.get("right_asset_id"))
if str(value or "").isdigit()
}
comparison_assets: dict[int, dict] = {}
- if comparison_ids:
- marks = ",".join("?" * len(comparison_ids))
+ requested_ids = comparison_ids | explicit_ids
+ if requested_ids:
+ marks = ",".join("?" * len(requested_ids))
for asset in connection.execute(
f"SELECT id,name,code,snapshot_path FROM asset WHERE id IN ({marks})",
- sorted(comparison_ids),
+ sorted(requested_ids),
):
comparison_assets[asset["id"]] = dict(asset)
@@ -1246,6 +1253,9 @@ def _attach_review_asset_context(connection, rows: list[dict]) -> None:
entity_id = str(row.get("entity_id") or "")
if asset is None and entity_id.isdigit():
asset = assets_by_entity.get(int(entity_id))
+ explicit_id = str(row.get("asset_id") or "")
+ if asset is None and explicit_id.isdigit():
+ asset = comparison_assets.get(int(explicit_id))
if asset is None and row.get("preview_assets"):
first = row["preview_assets"][0]
asset = {"id": first["id"], "name": first["name"], "code": code,
@@ -1311,6 +1321,14 @@ def _review_rows(contract: WebContract, category: str) -> tuple[list[dict], str
row["decision_note"] = decision.get("note", "")
row["preview_url"] = (row.get("resolved_url") or row.get("source_url")
or row.get("avatar_url") or row.get("portrait_url") or "")
+ if category == "video_endcards":
+ frame = PurePosixPath(str(row.get("frame_key") or ""))
+ asset_id = str(row.get("asset_id") or "")
+ if (asset_id.isdigit() and len(frame.parts) == 2
+ and frame.parts[0] == asset_id and frame.suffix.lower() == ".png"):
+ row["preview_url"] = (
+ f"/endcard-frame?id={asset_id}&name={quote(frame.name)}"
+ )
if category == "cover_sources" and row.get("result") == "取得":
# 封面已经在本机,直接看落盘的那张,不要回源站再拉一次。
row["preview_url"] = f"/cover?code={quote(str(row.get('code') or ''))}"
@@ -1842,7 +1860,7 @@ def w_review_decision(contract: WebContract, body):
if category not in {
"metadata_fields", "creator_tags", "studio_logos", "performer_avatars",
"western_identity", "code_creators", "fc2_markings", "fc2_similarity",
- "media_failure",
+ "video_endcards", "media_failure",
}:
raise ValueError("invalid review category")
if not item_key or status not in {"approved", "rejected", "skipped"}:
diff --git a/tests/test_endcard.py b/tests/test_endcard.py
new file mode 100644
index 000000000..1faf87e4e
--- /dev/null
+++ b/tests/test_endcard.py
@@ -0,0 +1,153 @@
+import csv
+import hashlib
+import importlib.util
+import json
+import shutil
+import sqlite3
+import tempfile
+import unittest
+from pathlib import Path
+
+from peach.endcard import detect_endcard
+
+
+ROOT = Path(__file__).resolve().parents[1]
+
+
+def load_script():
+ path = ROOT / "scripts" / "audit_video_endcards.py"
+ spec = importlib.util.spec_from_file_location("audit_video_endcards", path)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
+
+class EndcardDetectionTests(unittest.TestCase):
+ def test_full_version_endcard_is_an_incomplete_candidate(self):
+ detection = detect_endcard(
+ "Full version available on:\nfansly.com/smuzililpussy"
+ )
+ self.assertEqual(detection.verdict, "incomplete_candidate")
+ self.assertTrue(detection.full_version)
+ self.assertEqual(detection.urls, ("fansly.com/smuzililpussy",))
+ self.assertEqual(detection.confidence, 0.98)
+
+ def test_watermark_without_full_version_is_source_evidence(self):
+ detection = detect_endcard("mirror.example.com @source_account")
+ self.assertEqual(detection.verdict, "source_evidence")
+ self.assertEqual(detection.handles, ("source_account",))
+
+ def test_ordinary_subtitle_is_not_a_candidate(self):
+ self.assertEqual(detect_endcard("More, I'm cumming.").verdict, "none")
+
+
+class FakeOcr:
+ def __init__(self):
+ self.calls = 0
+
+ def recognize(self, paths):
+ self.calls += 1
+ return {
+ str(path.resolve()): {
+ "path": str(path.resolve()),
+ "text": (
+ "Full version available on: fansly.com/smuzililpussy"
+ if path.name.startswith("tail-") else "More, I'm cumming."
+ ),
+ "lines": [], "error": "",
+ }
+ for path in paths
+ }
+
+
+class EndcardAuditScriptTests(unittest.TestCase):
+ def setUp(self):
+ self.tmp = Path(tempfile.mkdtemp())
+ self.addCleanup(shutil.rmtree, self.tmp, True)
+ self.module = load_script()
+ self.db = self.tmp / "ledger.db"
+ connection = sqlite3.connect(self.db)
+ connection.execute(
+ "CREATE TABLE asset(id INTEGER PRIMARY KEY,location TEXT,path TEXT,name TEXT,"
+ "code TEXT,duration REAL,size INTEGER,medium TEXT,disposal TEXT)"
+ )
+ connection.execute(
+ "INSERT INTO asset VALUES(1,'115',?,'sample.mp4','',507.6071,1000,'video',NULL)",
+ (str(self.tmp / "sample.mp4"),),
+ )
+ connection.commit(); connection.close()
+ self.evidence = self.tmp / "evidence"
+ self.out = self.tmp / "video-endcard-candidate-test.csv"
+ self.health = self.tmp / "video-endcard-health-test.csv"
+ self.lock = self.tmp / "endcard.lock"
+
+ def args(self, *extra):
+ return self.module.build_parser().parse_args([
+ "--db", str(self.db), "--asset", "1", "--min-free", "0",
+ "--head-offsets", "0.5", "--tail-offsets", "2",
+ "--evidence-root", str(self.evidence), "--out", str(self.out),
+ "--health", str(self.health), "--lock", str(self.lock), *extra,
+ ])
+
+ @staticmethod
+ def capture(_ffmpeg, _source, _timestamp, destination):
+ destination.parent.mkdir(parents=True, exist_ok=True)
+ destination.write_bytes(b"P" * 2048)
+ return True
+
+ def test_candidate_frames_and_ocr_are_cached_without_database_writes(self):
+ ocr = FakeOcr()
+ before = hashlib.sha256(self.db.read_bytes()).hexdigest()
+ result = self.module.run(
+ self.args(), capture=self.capture, ocr=ocr, ffmpeg_path="fake-ffmpeg",
+ )
+ self.assertEqual(result, 0)
+ self.assertEqual(hashlib.sha256(self.db.read_bytes()).hexdigest(), before)
+ with self.out.open(encoding="utf-8-sig", newline="") as handle:
+ rows = list(csv.DictReader(handle))
+ self.assertEqual(len(rows), 1)
+ self.assertEqual(rows[0]["asset_id"], "1")
+ self.assertEqual(rows[0]["verdict"], "incomplete_candidate")
+ self.assertEqual(rows[0]["detected_urls"], "fansly.com/smuzililpussy")
+ self.assertEqual(rows[0]["sample_kind"], "tail")
+ self.assertFalse(Path(rows[0]["frame_key"]).is_absolute())
+ self.assertEqual(ocr.calls, 1)
+
+ class NoOcr:
+ def recognize(self, _paths):
+ raise AssertionError("OCR cache should be reused")
+
+ def no_capture(*_args):
+ raise AssertionError("frame cache should be reused")
+
+ result = self.module.run(
+ self.args(), capture=no_capture, ocr=NoOcr(), ffmpeg_path="fake-ffmpeg",
+ )
+ self.assertEqual(result, 0)
+ with self.health.open(encoding="utf-8-sig", newline="") as handle:
+ health = next(csv.DictReader(handle))
+ self.assertEqual(health["frame_cache_reused"], "2")
+ self.assertEqual(health["ocr_cache_reused"], "2")
+ self.assertEqual(health["capture_errors"], "0")
+ self.assertEqual(health["ocr_errors"], "0")
+
+ def test_no_unbounded_default_batch(self):
+ args = self.module.build_parser().parse_args([
+ "--db", str(self.db), "--min-free", "0", "--out", str(self.out),
+ "--health", str(self.health), "--evidence-root", str(self.evidence),
+ ])
+ result = self.module.run(args, ocr=FakeOcr(), ffmpeg_path="fake-ffmpeg")
+ self.assertEqual(result, 2)
+ with self.health.open(encoding="utf-8-sig", newline="") as handle:
+ health = next(csv.DictReader(handle))
+ self.assertEqual(health["last_error_kind"], "ValueError")
+
+ def test_sample_points_cover_head_and_tail_without_duplicates(self):
+ points = self.module.sample_points(10, (0.5, 2), (0.5, 2, 20))
+ self.assertEqual(points, [
+ ("head", 0.5), ("head", 2), ("tail", 9.5), ("tail", 8),
+ ])
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/test_fastapi_api.py b/tests/test_fastapi_api.py
index 3474d296b..defcddb43 100644
--- a/tests/test_fastapi_api.py
+++ b/tests/test_fastapi_api.py
@@ -108,6 +108,11 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):
# 复核候选必须来自临时目录:早先版本直接读真实的 R:\peach-data\generated。
self.candidate_root = self.root / "generated"
self.candidate_root.mkdir()
+ self.endcard_frame = (
+ self.candidate_root / "endcard-evidence" / "1" / "tail-000098000.png"
+ )
+ self.endcard_frame.parent.mkdir(parents=True)
+ self.endcard_frame.write_bytes(b"endcard")
for path in (self.media_root, self.snapshot_root, self.poster_root,
self.avatar_root, self.logo_root, self.vendor_root):
path.mkdir()
@@ -677,6 +682,24 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):
self.assertEqual(logo.headers["content-type"], "image/png")
self.assertEqual(poster.headers["cache-control"], "public, max-age=86400")
+ async def test_endcard_frame_is_authenticated_and_confined_to_evidence_root(self):
+ denied = await self.client.get(
+ "/endcard-frame?id=1&name=tail-000098000.png"
+ )
+ self.assertEqual(denied.status_code, 401)
+ response = await self.client.get(
+ "/endcard-frame?id=1&name=tail-000098000.png",
+ headers={"X-Token": "secret"},
+ )
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.content, b"endcard")
+ self.assertEqual(response.headers["content-type"], "image/png")
+ traversal = await self.client.get(
+ "/endcard-frame?id=1&name=../index.html",
+ headers={"X-Token": "secret"},
+ )
+ self.assertEqual(traversal.status_code, 400)
+
def _seed_photo(self):
"""一张真实 JPEG:缩略图端点要真的解码,假字节测不出这条路径。"""
from PIL import Image
diff --git a/tests/test_rm_web.py b/tests/test_rm_web.py
index b563679cd..c9c60d444 100644
--- a/tests/test_rm_web.py
+++ b/tests/test_rm_web.py
@@ -1324,6 +1324,31 @@ class ReviewQueueTests(unittest.TestCase):
})
self.assertEqual(result["applied_assets"], 0)
+ def test_endcard_candidate_links_ocr_frame_and_original_video(self):
+ fields = ["candidate_key", "asset_id", "name", "sample_kind",
+ "timestamp_seconds", "frame_key", "ocr_text", "verdict",
+ "detected_urls", "confidence", "reason", "status"]
+ self._csv("video-endcard-candidate-20260825.csv", fields, [{
+ "candidate_key": "1", "asset_id": "1", "name": "1.mp4",
+ "sample_kind": "tail", "timestamp_seconds": "98",
+ "frame_key": "1/tail-000098000.png",
+ "ocr_text": "Full version available on: fansly.com/example",
+ "verdict": "incomplete_candidate", "detected_urls": "fansly.com/example",
+ "confidence": "0.98", "reason": "片尾明确写有 Full version available",
+ "status": "candidate",
+ }])
+ row = rm_web.q_review(self.contract)["sections"]["video_endcards"][0]
+ self.assertEqual(row["item_key"], "1")
+ self.assertEqual(row["asset_id"], 1)
+ self.assertEqual(
+ row["preview_url"],
+ "/endcard-frame?id=1&name=tail-000098000.png",
+ )
+ result = rm_web.w_review_decision(self.contract, {
+ "category": "video_endcards", "item_key": "1", "status": "skipped",
+ })
+ self.assertEqual(result["applied_assets"], 0)
+
def test_code_creator_candidates_reach_the_review_page(self):
fields = ["entity_id", "creator", "verdict", "identity", "assets",
"sample_path", "code_action", "reason"]
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 4aa0fda0a..1e77f6cac 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -910,6 +910,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageLacks("cover_sources:'封面来源'")
self.assertPageContains("fc2_markings:'FC2 评论标记'")
self.assertPageContains("fc2_similarity:'FC2 跨号相似'")
+ self.assertPageContains("video_endcards:'片尾/出处证据'")
self.assertPageContains("const comparison=row.comparison_assets||[];")
self.assertPageContains('class="reviewcompare"')
self.assertPageContains("reviewCategory==='fc2_similarity'?''")
diff --git a/web/app.js b/web/app.js
index 9a5e6639c..55da8b81e 100644
--- a/web/app.js
+++ b/web/app.js
@@ -890,7 +890,7 @@ function closeStats(push=true){if(push)route('/');showHomeSurfaces();load(true)}
let reviewData=null,reviewCategory='metadata_fields';
/* 主体是实体而不是单条作品的复核分类。值就是实体 kind。 */
const ENTITY_REVIEW_CATEGORIES={creator_tags:'creator',western_identity:'creator'};
-const REVIEW_LABELS={metadata_fields:'元数据字段',creator_tags:'创作者标签',studio_logos:'厂牌 Logo',performer_avatars:'女优头像',western_identity:'西方身份回配',code_creators:'番号目录存疑',fc2_markings:'FC2 评论标记',fc2_similarity:'FC2 跨号相似',media_failure:'媒体失败'};
+const REVIEW_LABELS={metadata_fields:'元数据字段',creator_tags:'创作者标签',studio_logos:'厂牌 Logo',performer_avatars:'女优头像',western_identity:'西方身份回配',code_creators:'番号目录存疑',fc2_markings:'FC2 评论标记',fc2_similarity:'FC2 跨号相似',video_endcards:'片尾/出处证据',media_failure:'媒体失败'};
let dupData=null;
/* 重复文件。判据是「同番号 + 时长相近 + 分卷标记一致」,不是同番号即重复——
合集、分卷和混入的广告都会共用一个 code,只按番号做「保留最大」会删掉内容。