From 0a73c480f4c333334d1366e241147c93f892295b Mon Sep 17 00:00:00 2001 From: Louis Beaumont Date: Fri, 16 Aug 2024 10:15:54 +0200 Subject: [PATCH] chore: change default settings on mac, improve clarity of logs on cli boot --- screenpipe-audio/src/core.rs | 2 - .../src/bin/screenpipe-server.rs | 61 ++++++++++++++++--- screenpipe-server/src/core.rs | 1 - 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/screenpipe-audio/src/core.rs b/screenpipe-audio/src/core.rs index ca618dc0a..aad411a41 100644 --- a/screenpipe-audio/src/core.rs +++ b/screenpipe-audio/src/core.rs @@ -340,7 +340,6 @@ pub fn list_audio_devices() -> Result> { pub fn default_input_device() -> Result { let host = cpal::default_host(); let device = host.default_input_device().unwrap(); - info!("Using default input device: {}", device.name()?); Ok(AudioDevice::new(device.name()?, DeviceType::Input)) } @@ -364,7 +363,6 @@ pub fn default_output_device() -> Result { let device = host .default_output_device() .ok_or_else(|| anyhow!("No default output device found"))?; - info!("Using default output device: {}", device.name()?); return Ok(AudioDevice::new(device.name()?, DeviceType::Output)); } } diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs index 619c68921..2777f8748 100644 --- a/screenpipe-server/src/bin/screenpipe-server.rs +++ b/screenpipe-server/src/bin/screenpipe-server.rs @@ -80,9 +80,10 @@ struct Cli { /// 5 FPS = 150 GB / month /// Optimise based on your needs. /// Your screen rarely change more than 1 times within a second, right? - #[arg(short, long, default_value_t = 1.0)] - fps: f64, - + #[cfg_attr(not(target_os = "macos"), arg(short, long, default_value_t = 1.0))] + #[cfg_attr(target_os = "macos", arg(short, long, default_value_t = 0.2))] + fps: f64, // ! not crazy about this (unconsistent behaviour across platforms) see https://github.com/louis030195/screen-pipe/issues/173 + /// Audio chunk duration in seconds #[arg(short, long, default_value_t = 30)] audio_chunk_duration: u64, @@ -194,6 +195,7 @@ async fn main() -> anyhow::Result<()> { // tokio-console // console_subscriber::init(); let local_data_dir = get_base_dir(cli.data_dir)?; + let local_data_dir_clone = local_data_dir.clone(); let log_file = File::create(format!( "{}/screenpipe.log", @@ -248,7 +250,6 @@ async fn main() -> anyhow::Result<()> { let audio_devices_control_server = audio_devices_control.clone(); - info!("Available audio devices:"); // Add all available audio devices to the controls for device in &all_audio_devices { let device_control = DeviceControl { @@ -256,12 +257,10 @@ async fn main() -> anyhow::Result<()> { is_paused: false, }; devices_status.insert(device.clone(), device_control); - info!(" {}", device); } if !cli.disable_audio { if cli.audio_device.is_empty() { - debug!("Using default devices"); // Use default devices if let Ok(input_device) = default_input_device() { audio_devices.push(Arc::new(input_device.clone())); @@ -300,7 +299,6 @@ async fn main() -> anyhow::Result<()> { if audio_devices.is_empty() { eprintln!("No audio devices available. Audio recording will be disabled."); } else { - info!("Using audio devices:"); for device in &audio_devices { info!(" {}", device); @@ -354,6 +352,7 @@ async fn main() -> anyhow::Result<()> { eprintln!("{}", format!("Monitor with id {} not found. Try 'screenpipe --list-monitors'", monitor_id).red()); std::process::exit(1); }); + let ocr_engine_clone = cli.ocr_engine.clone(); // Function to start or restart the recording task let _start_recording = tokio::spawn(async move { @@ -441,6 +440,54 @@ async fn main() -> anyhow::Result<()> { "Open source | Runs locally | Developer friendly".bright_green() ); + println!("┌─────────────────────┬────────────────────────────────────┐"); + println!("│ Setting │ Value │"); + println!("├─────────────────────┼────────────────────────────────────┤"); + println!("│ FPS │ {:<34} │", cli.fps); + println!("│ Audio Chunk Duration│ {:<34} │", format!("{} seconds", cli.audio_chunk_duration)); + println!("│ Port │ {:<34} │", cli.port); + println!("│ Audio Disabled │ {:<34} │", cli.disable_audio); + println!("│ Self Healing │ {:<34} │", cli.self_healing); + println!("│ Save Text Files │ {:<34} │", cli.save_text_files); + println!("│ Cloud Audio │ {:<34} │", cli.cloud_audio_on); + println!("│ OCR Engine │ {:<34} │", format!("{:?}", ocr_engine_clone)); + println!("│ Monitor ID │ {:<34} │", monitor_id); + println!("│ Data Directory │ {:<34} │", local_data_dir_clone.display()); + println!("│ Debug Mode │ {:<34} │", cli.debug); + const VALUE_WIDTH: usize = 34; + + // Function to truncate and pad strings + fn format_cell(s: &str, width: usize) -> String { + if s.len() > width { + format!("{}...", &s[..width - 3]) + } else { + format!("{:, monitor_id: u32, ) -> Result<()> { - info!("Recording now"); let (whisper_sender, whisper_receiver) = create_whisper_channel(cloud_audio).await?;