From 2408b9626a53da85be2e443568284075d836ba79 Mon Sep 17 00:00:00 2001 From: jlvihv Date: Wed, 26 Jun 2024 11:07:58 +0800 Subject: [PATCH] fix ffmpeg path --- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/src/ffmpeg.rs | 10 +++++++--- src-tauri/tauri.conf.json | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index e5ff1da..f40ae57 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2760,7 +2760,7 @@ checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" [[package]] name = "liveship" -version = "0.1.24" +version = "0.1.25" dependencies = [ "anyhow", "async-trait", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 50f15cf..b9ace7f 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "liveship" -version = "0.1.24" +version = "0.1.25" description = "liveship is a compact and user-friendly live stream recording tool that captures live streams as video files." authors = ["jlvihv"] email = "imvihv@gmail.com" diff --git a/src-tauri/src/ffmpeg.rs b/src-tauri/src/ffmpeg.rs index 077acfe..f3fa082 100644 --- a/src-tauri/src/ffmpeg.rs +++ b/src-tauri/src/ffmpeg.rs @@ -3,13 +3,15 @@ pub use anyhow::Result; use ffmpeg_sidecar::download::{download_ffmpeg_package, ffmpeg_download_url, unpack_ffmpeg}; use std::process::{Child, Stdio}; -use crate::{config::config_dir, model::RecordingOption}; +use crate::{config::config_dir, kv, model::RecordingOption}; /// 给定 ffmpeg 命令,这里只负责执行 pub fn execute_ffmpeg_command(ffmpeg_command: Vec) -> Result { println!("ffmpeg_command: {:?}", ffmpeg_command); // 调用 ffmpeg 命令 - let mut cmd = std::process::Command::new("ffmpeg"); + // 获取配置文件中的 ffmpeg 路径 + let ffmpeg_path = kv::config::get()?.ffmpeg_path; + let mut cmd = std::process::Command::new(ffmpeg_path); // 特定于 windows 的实现,使用 CommandExt,避免出现黑窗口 #[cfg(target_os = "windows")] { @@ -38,7 +40,9 @@ pub fn execute_ffmpeg_command(ffmpeg_command: Vec) -> Result { pub fn execute_ffmpeg_command_return_output(ffmpeg_command: Vec) -> Result { println!("ffmpeg_command: {:?}", ffmpeg_command); // 调用 ffmpeg 命令 - let output = std::process::Command::new("ffmpeg") + // 获取配置文件中的 ffmpeg 路径 + let ffmpeg_path = kv::config::get()?.ffmpeg_path; + let output = std::process::Command::new(ffmpeg_path) .args(&ffmpeg_command) .output()?; let stdout = String::from_utf8_lossy(&output.stdout); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 0c07447..31cea24 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "liveship", - "version": "0.1.24", + "version": "0.1.25", "identifier": "app.happyship.liveship", "build": { "beforeDevCommand": "bun run dev",