diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index 34a7da3..0fc8fc2 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -20,7 +20,6 @@ pub struct BatchAIVideoRequest { pub timeout: Option, } use std::process::Command; -use tauri::State; #[derive(Debug, Serialize, Deserialize)] pub struct VideoProcessRequest { @@ -65,6 +64,27 @@ pub struct AudioTrack { pub volume: f64, } +// Helper function to execute Python commands +async fn execute_python_command(args: &[String]) -> Result { + let mut cmd = Command::new("python3"); + + for arg in args { + cmd.arg(arg); + } + + let output = cmd + .output() + .map_err(|e| format!("Failed to execute Python script: {}", e))?; + + if output.status.success() { + let result = String::from_utf8_lossy(&output.stdout); + Ok(result.to_string()) + } else { + let error = String::from_utf8_lossy(&output.stderr); + Err(format!("Python script error: {}", error)) + } +} + #[tauri::command] pub async fn greet(name: &str) -> Result { Ok(format!("Hello, {}! Welcome to MixVideo V2!", name)) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index ba0b38f..db8d0e2 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,5 +1,3 @@ -use tauri::Manager; - mod commands; #[cfg_attr(mobile, tauri::mobile_entry_point)]