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
fix: remove panicking unwrap() in audio device listing and frame extraction
Louis Beaumont490012200c14
diff --git a/crates/screenpipe-audio/src/core/device.rs b/crates/screenpipe-audio/src/core/device.rsindex dfeeabfad..d96b739f4 100644--- a/crates/screenpipe-audio/src/core/device.rs+++ b/crates/screenpipe-audio/src/core/device.rs@@ -294,13 +294,18 @@ pub async fn list_audio_devices() -> Result<Vec<AudioDevice>> {}// last, add devices that are listed in .devices() which are not already in the devices vector- let other_devices = host.devices().unwrap();- for device in other_devices {- if !devices.iter().any(|d| d.name == device.name().unwrap())- && should_include_output_device(&device.name().unwrap())- {- // TODO: not sure if it can be input, usually aggregate or multi output- devices.push(AudioDevice::new(device.name().unwrap(), DeviceType::Output));+ if let Ok(other_devices) = host.devices() {+ for device in other_devices {+ let name = match device.name() {+ Ok(n) => n,+ Err(_) => continue,+ };+ if !devices.iter().any(|d| d.name == name)+ && should_include_output_device(&name)+ {+ // TODO: not sure if it can be input, usually aggregate or multi output+ devices.push(AudioDevice::new(name, DeviceType::Output));+ }}}diff --git a/crates/screenpipe-server/src/server.rs b/crates/screenpipe-server/src/server.rsindex 678396020..f278df9df 100644--- a/crates/screenpipe-server/src/server.rs+++ b/crates/screenpipe-server/src/server.rs@@ -581,7 +581,13 @@ pub(crate) async fn search(}).collect();- let frames = try_join_all(frame_futures).await.unwrap(); // TODO: handle error+ let frames = match try_join_all(frame_futures).await {+ Ok(f) => f,+ Err(e) => {+ tracing::warn!("failed to extract some frames: {}", e);+ vec![]+ }+ };for (item, frame) in content_items.iter_mut().zip(frames.into_iter()) {if let ContentItem::OCR(ref mut ocr_content) = item {