From e60227ffd1bdacd997e4e0a9cd71259d35a42d61 Mon Sep 17 00:00:00 2001 From: ali Date: Thu, 19 Nov 2026 00:49:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(preflight):=20=E6=8A=A5=E5=91=8A=E5=8F=AA?= =?UTF-8?q?=E5=9C=A8=E6=95=B4=E5=BA=93=E6=89=AB=E6=8F=8F=E4=B8=94=E6=9C=89?= =?UTF-8?q?=E9=9D=9E=20READY=20=E6=97=B6=E8=90=BD=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media/src/core/pipeline.py | 4 +++- media/src/services/preflight.py | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/media/src/core/pipeline.py b/media/src/core/pipeline.py index 7f2903d..2b7cec7 100644 --- a/media/src/core/pipeline.py +++ b/media/src/core/pipeline.py @@ -33,7 +33,9 @@ class MediaPipeline: return self._generate_plan() - PreflightService.write_report(self.target_dir, self.preflight) + # 只在「整库扫描」且存在 PREP/BLOCKED 时落报告,避免每个剧目录多一个 CSV + if self.target_dir.resolve() == config.MEDIA_ROOT.resolve(): + PreflightService.write_report(self.target_dir, self.preflight, only_issues=True) if not self.task_mgr.has_tasks(): if not self.auto_execute: log.info("✨ 您的媒体库目前处于完美状态,无需任何物理变更。") diff --git a/media/src/services/preflight.py b/media/src/services/preflight.py index 867f41d..2165a06 100644 --- a/media/src/services/preflight.py +++ b/media/src/services/preflight.py @@ -305,10 +305,14 @@ class PreflightService: # ------------------------------------------------------------------ 报告 @classmethod - def write_report(cls, root: Path, results: list) -> Path | None: + def write_report(cls, root: Path, results: list, only_issues: bool = False) -> Path | None: """results: [(path, PreflightResult)],输出 root/preflight_report.csv""" if not config.PREFLIGHT_REPORT or not results: return None + if only_issues: + results = [(p, r) for p, r in results if r.verdict != READY] + if not results: + return None report = root / "preflight_report.csv" header = "path,verdict,codec,height,mbps,dv_profile,audio_codecs,sub_codecs,actions,reasons\n" lines = [header]