diff --git a/src/api/media_api.rs b/src/api/media_api.rs index 607ed84..07d4602 100644 --- a/src/api/media_api.rs +++ b/src/api/media_api.rs @@ -376,15 +376,15 @@ async fn trace_video( } } - // Query cut_id for this segment - let cut_table = schema::table_name("cut"); - let cut_id: i32 = sqlx::query_scalar( - &format!("SELECT scene_number FROM {} WHERE file_uuid = $1 AND start_frame <= $2 AND end_frame >= $2 LIMIT 1", cut_table) + // Query cut/scene info from chunk table (not a separate "cut" table) + let chunk_table = schema::table_name("chunk"); + let cut_label: String = sqlx::query_scalar::<_, String>( + &format!("SELECT chunk_id FROM {} WHERE file_uuid = $1 AND chunk_type = 'cut' AND start_frame <= $2 AND end_frame >= $2 LIMIT 1", chunk_table) ) .bind(&file_uuid).bind(first_frame) .fetch_optional(state.db.pool()).await .unwrap_or(None) - .unwrap_or(0); + .unwrap_or_else(|| "-".to_string()); // Sort traces for consistent ordering let mut sorted_traces: Vec<(i32, &Vec)> = trace_frames.iter().map(|(k, v)| (*k, v)).collect(); @@ -402,7 +402,7 @@ async fn trace_video( "drawtext=text='Frame %{{n}} %{{pts}}':fontsize=28:fontcolor=white:box=1:boxcolor=black@0.6:x=10:y=12" )); parts.push(format!( - "drawtext=text='Cut\\: {}':fontsize=28:fontcolor=white:box=1:boxcolor=black@0.6:x=10:y=56", cut_id + "drawtext=text='Cut\\: {}':fontsize=28:fontcolor=white:box=1:boxcolor=black@0.6:x=10:y=56", cut_label )); parts.push(format!( "drawtext=text='{}':fontsize=28:fontcolor=white:box=1:boxcolor=black@0.6:x=10:y=100", file_uuid