From 36fc4d0360abece50a6094613863c2472469035f Mon Sep 17 00:00:00 2001 From: Accusys Date: Thu, 19 Nov 2026 19:18:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20pHash=20dedup=20=E5=BE=8C=E5=88=AA?= =?UTF-8?q?=E9=99=A4=E5=AD=A4=E7=AB=8B=20scene=20jpg=EF=BC=88jpg=20?= =?UTF-8?q?=E6=95=B8=20=3D=20scenes=20=E6=95=B8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: extract_scene_frames 先寫出全部 jpg,pHash dedup 後只調整 profile.scenes,但被移除 scene 的 jpg 沒刪除 → 磁碟 5 張 jpg 但 scenes.json 只有 4 個 scene(如 1c6f40 scene_003.jpg 孤立)。 修復: dedup 時對被移除的 scene 呼叫 std::fs::remove_file 刪除 jpg。 已清理 1c6f40 的孤立 scene_003.jpg。 --- src/worker/job_worker.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/worker/job_worker.rs b/src/worker/job_worker.rs index c3ed2f07..1a4c3076 100644 --- a/src/worker/job_worker.rs +++ b/src/worker/job_worker.rs @@ -5728,6 +5728,11 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> { if keep_set.contains(&i) { new_scenes.push(scene); new_extracted.push(path); + } else { + // Remove the now-orphaned scene jpg so disk matches scenes.json. + if let Err(e) = std::fs::remove_file(&path) { + debug!("[DEDUP] failed to remove orphan scene jpg {:?}: {}", path, e); + } } } profile.scenes = new_scenes;