YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
release-app fix issue with ffmpeg on macos tauri app
Louis Beaumontfb8e2a2a6f10
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.tomlindex 218be8d39..883b1d9c6 100644--- a/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "screenpipe-app"-version = "0.14.32"+version = "0.14.33"description = ""authors = ["you"]license = ""diff --git a/screenpipe-core/src/ffmpeg.rs b/screenpipe-core/src/ffmpeg.rsindex 1c390dad1..1073f0615 100644--- a/screenpipe-core/src/ffmpeg.rs+++ b/screenpipe-core/src/ffmpeg.rs@@ -1,13 +1,13 @@-use log::{debug, error};-use std::path::PathBuf;-use which::which;use ffmpeg_sidecar::{command::ffmpeg_is_installed,download::{check_latest_version, download_ffmpeg_package, ffmpeg_download_url, unpack_ffmpeg},paths::sidecar_dir,version::ffmpeg_version,};+use log::{debug, error};use once_cell::sync::Lazy;+use std::path::PathBuf;+use which::which;#[cfg(not(windows))]const EXECUTABLE_NAME: &str = "ffmpeg";@@ -112,7 +112,7 @@ fn find_ffmpeg_path_internal() -> Option<PathBuf> {None // Return None if ffmpeg is not found}-fn handle_ffmpeg_installation() -> Result<(), String> {+fn handle_ffmpeg_installation() -> Result<(), anyhow::Error> {if ffmpeg_is_installed() {debug!("ffmpeg is already installed");return Ok(());@@ -124,19 +124,60 @@ fn handle_ffmpeg_installation() -> Result<(), String> {Err(e) => debug!("skipping version check due to error: {e}"),}- let download_url = ffmpeg_download_url().map_err(|e| e.to_string())?;- let destination = sidecar_dir().map_err(|e| e.to_string())?;+ let download_url = ffmpeg_download_url()?;+ let destination = get_ffmpeg_install_dir()?;debug!("downloading from: {:?}", download_url);- let archive_path =- download_ffmpeg_package(download_url, &destination).map_err(|e| e.to_string())?;+ let archive_path = download_ffmpeg_package(download_url, &destination)?;debug!("downloaded package: {:?}", archive_path);debug!("extracting...");- unpack_ffmpeg(&archive_path, &destination).map_err(|e| e.to_string())?;+ unpack_ffmpeg(&archive_path, &destination)?;- let version = ffmpeg_version().map_err(|e| e.to_string())?;+ let version = ffmpeg_version()?;debug!("done! installed ffmpeg version {}", version);Ok(())}++#[cfg(target_os = "macos")]+fn get_ffmpeg_install_dir() -> Result<PathBuf, anyhow::Error> {+ let home = dirs::home_dir().ok_or_else(|| anyhow::anyhow!("couldn't find home directory"))?;++ let local_bin = home.join(".local").join("bin");++ // Create directory if it doesn't exist+ if !local_bin.exists() {+ debug!("creating .local/bin directory");+ std::fs::create_dir_all(&local_bin)?;++ // Check both .bashrc and .zshrc+ let shell_configs = vec![+ home.join(".bashrc"),+ home.join(".bash_profile"), // macOS often uses .bash_profile instead of .bashrc+ home.join(".zshrc"),+ ];++ for config in shell_configs {+ if config.exists() {+ let content = std::fs::read_to_string(&config)?;+ if !content.contains(".local/bin") {+ debug!("adding .local/bin to PATH in {:?}", config);+ std::fs::write(+ config,+ format!("{}\nexport PATH=\"$HOME/.local/bin:$PATH\"\n", content),+ )?;+ }+ }+ }+ }++ Ok(local_bin)+}++// For other platforms, keep your existing installation directory logic+#[cfg(not(target_os = "macos"))]+fn get_ffmpeg_install_dir() -> Result<PathBuf, anyhow::Error> {+ // Your existing logic for other platforms+ sidecar_dir().map_err(|e| anyhow!(e))+}