fix: output-completeness 檢查改用 per-library 路徑 — 修復 test library 誤報缺項
- 原本用全域 OUTPUT_DIR(demo) 檢查所有影片 - test 檔案的 json 在 output/test → 誤報 6 項 missing - 改用 get_output_dir_for_file(uuid) + global fallback
This commit is contained in:
+13
-1
@@ -935,7 +935,7 @@ struct OutputCompletenessItem {
|
|||||||
async fn get_output_completeness(
|
async fn get_output_completeness(
|
||||||
State(state): State<AppState>,
|
State(state): State<AppState>,
|
||||||
) -> Result<Json<serde_json::Value>, StatusCode> {
|
) -> Result<Json<serde_json::Value>, 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 videos_table = schema::table_name("videos");
|
||||||
|
|
||||||
let rows: Vec<(String, String, String)> = sqlx::query_as(&format!(
|
let rows: Vec<(String, String, String)> = sqlx::query_as(&format!(
|
||||||
@@ -956,15 +956,27 @@ async fn get_output_completeness(
|
|||||||
continue; // 只檢查 completed 的影片
|
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();
|
let mut missing = Vec::new();
|
||||||
|
|
||||||
// 檢查 JSON 產出
|
// 檢查 JSON 產出
|
||||||
for ext in ["asrx", "cut", "face", "face_cluster", "face_traced", "ocr", "scenes"] {
|
for ext in ["asrx", "cut", "face", "face_cluster", "face_traced", "ocr", "scenes"] {
|
||||||
let path = format!("{}/{}.{}.json", output_dir, uuid, ext);
|
let path = format!("{}/{}.{}.json", output_dir, uuid, ext);
|
||||||
if !std::path::Path::new(&path).exists() {
|
if !std::path::Path::new(&path).exists() {
|
||||||
|
// 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));
|
missing.push(format!("{}.json", ext));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 檢查 trace 目錄(如果有 faces)
|
// 檢查 trace 目錄(如果有 faces)
|
||||||
let face_json = format!("{}/{}.face.json", output_dir, uuid);
|
let face_json = format!("{}/{}.face.json", output_dir, uuid);
|
||||||
|
|||||||
Reference in New Issue
Block a user