시작 시 메타 백필 + 백그라운드 처리 진행 표시(상태바)

- 메타 백필: 이전 스캔이 중단돼 meta_state=0으로 남은 파일을 시작 시
  (전체 재스캔 없이) 저우선순위로 이어서 분석. 썸네일 백필(enqueue_pending)과 짝.
- pending_counts 커맨드 + 상태바 표시: "썸네일 생성 중 N / 메타 분석 중 M".
  thumbs-ready·library-changed·시작 시 트리거하고, 남은 작업이 있으면 2초 폴링,
  0이 되면 자동으로 숨김.

검증: 영상 200개 스캔 중 상태바가 200→0으로 감소 후 사라짐. 메타 도중
강제 종료 후 재실행 시 재스캔 없이(scanning=false) 메타/썸네일 백필만 재개됨.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
강 한
2026-07-19 20:18:09 +09:00
co-authored by Claude Fable 5
parent 2bb1711ffa
commit e95772e79b
7 changed files with 112 additions and 4 deletions
+30
View File
@@ -48,6 +48,36 @@ pub struct SourceDto {
pub file_count: i64,
}
#[derive(serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PendingCounts {
/// 썸네일 생성 대기(thumb_state=0) 이미지/영상 수
pub thumbs: i64,
/// 메타데이터 분석 대기(meta_state=0) 수
pub meta: i64,
}
/// 백그라운드 처리 진행 표시용 — 대기 중인 썸네일/메타 개수.
#[tauri::command]
pub fn pending_counts(state: tauri::State<'_, AppState>) -> CmdResult<PendingCounts> {
state
.db
.with_read(|conn| {
let thumbs: i64 = conn.query_row(
"SELECT count(*) FROM files WHERE thumb_state=0 AND kind IN (0,1) AND deleted_at IS NULL",
[],
|r| r.get(0),
)?;
let meta: i64 = conn.query_row(
"SELECT count(*) FROM files WHERE meta_state=0 AND deleted_at IS NULL",
[],
|r| r.get(0),
)?;
Ok(PendingCounts { thumbs, meta })
})
.map_err(err_str)
}
#[tauri::command]
pub fn list_sources(state: tauri::State<'_, AppState>) -> CmdResult<Vec<SourceDto>> {
state