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
chore: attempt to package this shit
Louis Beaumont2d18f3a93334
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 310927381..f254933dd 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -54,53 +54,53 @@ jobs:uses: actions/checkout@v2- name: Install dependencies- run: brew install ffmpeg-- - name: Set up Rust- uses: actions-rs/toolchain@v1- with:- toolchain: stable- profile: minimal- override: true+ run: |+ brew install ffmpeg+ brew install create-dmg dav1d svt-av1 libarchive- - name: key- env:- MACOS_SIGNING_KEY: ${{ secrets.MACOS_SIGNING_KEY }}- MACOS_SIGNING_KEY_PASSWORD: ${{ secrets.MACOS_SIGNING_KEY_PASSWORD }}+ - name: Set up environmentrun: |- echo $MACOS_SIGNING_KEY | base64 --decode > certificate.p12- security create-keychain -p password build.keychain- security default-keychain -s build.keychain- security unlock-keychain -p password build.keychain- security import certificate.p12 -k build.keychain -P $MACOS_SIGNING_KEY_PASSWORD -T /usr/bin/codesign- security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password build.keychain- security set-keychain-settings -lut 3600 build.keychain+ echo "LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib" >> $GITHUB_ENV+ echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/homebrew/lib/pkgconfig:/opt/homebrew/opt/ffmpeg/lib/pkgconfig" >> $GITHUB_ENV- - name: Build- run: cargo build --release+ - name: Build with static FFmpeg+ run: |+ export PKG_CONFIG_PATH="/usr/local/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH"+ cargo build --release --features static-ffmpeg- - name: Sign Binary+ - name: Create app bundle+ run: |+ mkdir -p Screenpipe.app/Contents/MacOS+ mkdir -p Screenpipe.app/Contents/Resources+ cp target/release/screenpipe Screenpipe.app/Contents/MacOS/+ cp /usr/local/bin/ffmpeg Screenpipe.app/Contents/Resources/+ cp /usr/local/bin/ffprobe Screenpipe.app/Contents/Resources/+ # Create Info.plist file here if needed++ - name: Sign app bundleenv:MACOS_SIGNING_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY }}run: |- codesign --force --deep --options runtime --timestamp --sign "$MACOS_SIGNING_IDENTITY" target/release/screenpipe+ codesign --force --options runtime --deep --timestamp --sign "$MACOS_SIGNING_IDENTITY" Screenpipe.app++ - name: Create DMG+ run: create-dmg --volname "Screenpipe" --window-pos 200 120 --window-size 600 300 --icon-size 100 --icon "Screenpipe.app" 175 120 --hide-extension "Screenpipe.app" --app-drop-link 425 120 "Screenpipe.dmg" "Screenpipe.app"- - name: Notarize Binary+ - name: Notarize DMGenv:APPLE_ID: ${{ secrets.APPLE_ID }}APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}TEAM_ID: ${{ secrets.TEAM_ID }}run: |- zip screenpipe.zip target/release/screenpipe- xcrun notarytool submit screenpipe.zip --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$TEAM_ID" --wait- xcrun stapler staple screenpipe.zip+ xcrun notarytool submit Screenpipe.dmg --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$TEAM_ID" --wait+ xcrun stapler staple Screenpipe.dmg- name: Upload Artifactid: uploaduses: actions/upload-artifact@v2with:name: screenpipe-macos- path: target/release/screenpipe+ path: Screenpipe.dmgrelease:runs-on: ubuntu-latestdiff --git a/build.rs b/build.rsnew file mode 100644index 000000000..f2c049ddd--- /dev/null+++ b/build.rs@@ -0,0 +1,19 @@+fn main() {+ #[cfg(target_os = "macos")]+ {+ println!("cargo:rustc-link-lib=c++");+ println!("cargo:rustc-link-search=/usr/lib");+ println!("cargo:rustc-link-search=/opt/homebrew/lib");+ }++ #[cfg(target_os = "linux")]+ {+ println!("cargo:rustc-link-lib=stdc++");+ println!("cargo:rustc-link-search=/usr/lib");+ }++ #[cfg(target_os = "windows")]+ {+ // Windows-specific linking, if needed+ }+}diff --git a/screenpipe-server/Cargo.toml b/screenpipe-server/Cargo.tomlindex 0dedde5dd..76e489802 100644--- a/screenpipe-server/Cargo.toml+++ b/screenpipe-server/Cargo.toml@@ -65,6 +65,9 @@ clap = { version = "4.3", features = ["derive"] }[dev-dependencies]tempfile = "3.3.0"+[features]+static-ffmpeg = ["ffmpeg-next/static"]+[[bin]]name = "pipe"path = "src/bin/screenpipe-server.rs"diff --git a/screenpipe-server/src/video.rs b/screenpipe-server/src/video.rsindex aa674e04c..a9cf3597d 100644--- a/screenpipe-server/src/video.rs+++ b/screenpipe-server/src/video.rs@@ -9,11 +9,12 @@ use screenpipe_vision::{continuous_capture, CaptureResult, ControlMessage};use std::collections::{BTreeSet, VecDeque};use std::io::BufRead;use std::io::Write;+use std::path::PathBuf;use std::process::{Command, Stdio};use std::sync::mpsc::{channel, Receiver, Sender};use std::sync::{Arc, Mutex};-use std::thread;use std::time::Duration;+use std::{env, thread};use threadpool::ThreadPool;const MAX_THREADS: usize = 8; // Adjust based on your needs@@ -314,6 +315,33 @@ fn save_frames_as_video(}}+fn get_ffmpeg_path() -> PathBuf {+ if cfg!(target_os = "macos") {+ // When running on macOS, use the bundled FFmpeg+ let exe_path = env::current_exe().expect("Failed to get executable path");+ let resources_path = exe_path+ .parent()+ .unwrap()+ .parent()+ .unwrap()+ .join("Resources");+ let ffmpeg_path = resources_path.join("ffmpeg");+ // if not present, add a warning to the user+ if !ffmpeg_path.exists() {+ warn!(+ "FFmpeg not found in resources, defaulting to ffmpeg you probably installed with `brew install ffmpeg`. In production you should use statically linked ffmpeg."+ );+ // and just use ffmpeg from path+ PathBuf::from("ffmpeg")+ } else {+ ffmpeg_path+ }+ } else {+ // On other platforms, assume FFmpeg is in PATH+ PathBuf::from("ffmpeg")+ }+}+fn start_ffmpeg_process(output_file: &str, fps: f64) -> std::process::Child {// overrriding fps with max fps if over the max and warning userlet mut fps = fps;@@ -323,7 +351,7 @@ fn start_ffmpeg_process(output_file: &str, fps: f64) -> std::process::Child {}info!("Starting FFmpeg process for file: {}", output_file);- Command::new("ffmpeg")+ Command::new(get_ffmpeg_path().to_str().unwrap()).args(["-f","image2pipe",diff --git a/screenpipe-vision/Cargo.toml b/screenpipe-vision/Cargo.tomlindex ec91746b0..b33219604 100644--- a/screenpipe-vision/Cargo.toml+++ b/screenpipe-vision/Cargo.toml@@ -45,7 +45,6 @@ rand = "0.8.5"# Loglog = { workspace = true }-[dev-dependencies]tempfile = "3.3.0"