From 2df98eb31cb5b29fd3e117b683da0cf6f4d9128f Mon Sep 17 00:00:00 2001 From: Accusys Date: Thu, 19 Nov 2026 13:51:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20output-completeness=20=E6=AA=A2=E6=9F=A5?= =?UTF-8?q?=E6=94=B9=E7=94=A8=20per-library=20=E8=B7=AF=E5=BE=91=20?= =?UTF-8?q?=E2=80=94=20=E4=BF=AE=E5=BE=A9=20test=20library=20=E8=AA=A4?= =?UTF-8?q?=E5=A0=B1=E7=BC=BA=E9=A0=85=20-=20=E5=8E=9F=E6=9C=AC=E7=94=A8?= =?UTF-8?q?=E5=85=A8=E5=9F=9F=20OUTPUT=5FDIR(demo)=20=E6=AA=A2=E6=9F=A5?= =?UTF-8?q?=E6=89=80=E6=9C=89=E5=BD=B1=E7=89=87=20-=20test=20=E6=AA=94?= =?UTF-8?q?=E6=A1=88=E7=9A=84=20json=20=E5=9C=A8=20output/test=20=E2=86=92?= =?UTF-8?q?=20=E8=AA=A4=E5=A0=B1=206=20=E9=A0=85=20missing=20-=20=E6=94=B9?= =?UTF-8?q?=E7=94=A8=20get=5Foutput=5Fdir=5Ffor=5Ffile(uuid)=20+=20global?= =?UTF-8?q?=20fallback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/processing.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/api/processing.rs b/src/api/processing.rs index 9f4e1941..b28dd525 100644 --- a/src/api/processing.rs +++ b/src/api/processing.rs @@ -935,7 +935,7 @@ struct OutputCompletenessItem { async fn get_output_completeness( State(state): State, ) -> Result, StatusCode> { - let output_dir = crate::core::config::OUTPUT_DIR.to_string(); + let global_dir = crate::core::config::OUTPUT_DIR.as_str(); let videos_table = schema::table_name("videos"); let rows: Vec<(String, String, String)> = sqlx::query_as(&format!( @@ -956,13 +956,25 @@ async fn get_output_completeness( continue; // 只檢查 completed 的影片 } + // Per-library output dir with global fallback (test files live in output/test) + let per_lib = crate::core::config::get_output_dir_for_file(&uuid, state.db.pool()).await; + let output_dir = if std::path::Path::new(&per_lib).is_dir() { + per_lib + } else { + global_dir.to_string() + }; + let mut missing = Vec::new(); // 檢查 JSON 產出 for ext in ["asrx", "cut", "face", "face_cluster", "face_traced", "ocr", "scenes"] { let path = format!("{}/{}.{}.json", output_dir, uuid, ext); if !std::path::Path::new(&path).exists() { - missing.push(format!("{}.json", ext)); + // fallback to global dir + let global_path = format!("{}/{}.{}.json", global_dir, uuid, ext); + if !std::path::Path::new(&global_path).exists() { + missing.push(format!("{}.json", ext)); + } } }