fix(preflight): 报告只在整库扫描且有非 READY 时落盘
This commit is contained in:
@@ -33,7 +33,9 @@ class MediaPipeline:
|
|||||||
return
|
return
|
||||||
|
|
||||||
self._generate_plan()
|
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.task_mgr.has_tasks():
|
||||||
if not self.auto_execute: log.info("✨ 您的媒体库目前处于完美状态,无需任何物理变更。")
|
if not self.auto_execute: log.info("✨ 您的媒体库目前处于完美状态,无需任何物理变更。")
|
||||||
|
|||||||
@@ -305,10 +305,14 @@ class PreflightService:
|
|||||||
# ------------------------------------------------------------------ 报告
|
# ------------------------------------------------------------------ 报告
|
||||||
|
|
||||||
@classmethod
|
@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"""
|
"""results: [(path, PreflightResult)],输出 root/preflight_report.csv"""
|
||||||
if not config.PREFLIGHT_REPORT or not results:
|
if not config.PREFLIGHT_REPORT or not results:
|
||||||
return None
|
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"
|
report = root / "preflight_report.csv"
|
||||||
header = "path,verdict,codec,height,mbps,dv_profile,audio_codecs,sub_codecs,actions,reasons\n"
|
header = "path,verdict,codec,height,mbps,dv_profile,audio_codecs,sub_codecs,actions,reasons\n"
|
||||||
lines = [header]
|
lines = [header]
|
||||||
|
|||||||
Reference in New Issue
Block a user