Fix Ollama settings on startup + video extraction UX
AI provider: - Extract configureAIProvider() from saveSettings for reuse - Call it on app startup after sidecar is ready (was only called on Save) - Call it after first-time sidecar download completes - Sidecar now receives correct Ollama URL/model immediately Video extraction: - Hide ffmpeg console window on Windows (CREATE_NO_WINDOW flag) - Show "Extracting audio from video..." overlay with spinner during extraction - UI stays responsive while ffmpeg runs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::os::windows::process::CommandExt;
|
||||
|
||||
/// Extract audio from a video file to a WAV file using ffmpeg.
|
||||
/// Returns the path to the extracted audio file.
|
||||
#[tauri::command]
|
||||
@@ -23,8 +26,8 @@ pub fn extract_audio(file_path: String) -> Result<String, String> {
|
||||
// Find ffmpeg — check sidecar extract dir first, then system PATH
|
||||
let ffmpeg = find_ffmpeg().ok_or("ffmpeg not found. Install ffmpeg or ensure it's in PATH.")?;
|
||||
|
||||
let status = Command::new(&ffmpeg)
|
||||
.args([
|
||||
let mut cmd = Command::new(&ffmpeg);
|
||||
cmd.args([
|
||||
"-y", // Overwrite output
|
||||
"-i",
|
||||
&file_path,
|
||||
@@ -38,7 +41,13 @@ pub fn extract_audio(file_path: String) -> Result<String, String> {
|
||||
])
|
||||
.arg(output.to_str().unwrap())
|
||||
.stdout(std::process::Stdio::null())
|
||||
.stderr(std::process::Stdio::piped())
|
||||
.stderr(std::process::Stdio::piped());
|
||||
|
||||
// Hide the console window on Windows (CREATE_NO_WINDOW = 0x08000000)
|
||||
#[cfg(target_os = "windows")]
|
||||
cmd.creation_flags(0x08000000);
|
||||
|
||||
let status = cmd
|
||||
.status()
|
||||
.map_err(|e| format!("Failed to run ffmpeg: {e}"))?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user