Skip to content

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

feat: implement 'screenpipe audio list' and 'screenpipe vision list' sub commands

Louis Beaumont81211e3e60a8
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index b66b566ac..5db1d4e5c 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -17,7 +17,10 @@ use screenpipe_core::DeviceType;
use screenpipe_server::core::DeviceManager;
use screenpipe_server::VisionDeviceControlRequest;
use screenpipe_server::{
- cli::{Cli, CliAudioTranscriptionEngine, CliOcrEngine, Command, OutputFormat, PipeCommand},
+ cli::{
+ AudioCommand, Cli, CliAudioTranscriptionEngine, CliOcrEngine, Command, OutputFormat,
+ PipeCommand, VisionCommand,
+ },
core::{AudioConfig, RealtimeConfig, RecordingConfig, VisionConfig},
handle_index_command,
pipe_manager::PipeInfo,
@@ -193,6 +196,24 @@ async fn main() -> anyhow::Result<()> {
output: OutputFormat::Text,
..
}) => true,
+ Some(Command::Vision { subcommand }) => {
+ matches!(
+ subcommand,
+ VisionCommand::List {
+ output: OutputFormat::Text,
+ ..
+ }
+ )
+ }
+ Some(Command::Audio { subcommand }) => {
+ matches!(
+ subcommand,
+ AudioCommand::List {
+ output: OutputFormat::Text,
+ ..
+ }
+ )
+ }
_ => true,
};
@@ -211,6 +232,70 @@ async fn main() -> anyhow::Result<()> {
handle_pipe_command(subcommand, &pipe_manager).await?;
return Ok(());
}
+ Command::Vision { subcommand } => match subcommand {
+ VisionCommand::List { output } => {
+ let monitors = list_monitors().await;
+ match output {
+ OutputFormat::Json => {
+ println!(
+ "{}",
+ serde_json::to_string_pretty(&json!({
+ "data": monitors.iter().map(|m| {
+ json!({
+ "id": m.id(),
+ "name": m.name(),
+ "x": m.x(),
+ "y": m.y(),
+ "width": m.width(),
+ "height": m.height(),
+ "rotation": m.rotation(),
+ "scale_factor": m.scale_factor(),
+ "frequency": m.frequency(),
+ "is_primary": m.is_primary()
+ })
+ }).collect::<Vec<_>>(),
+ "success": true
+ }))?
+ );
+ }
+ OutputFormat::Text => {
+ println!("available monitors:");
+ for monitor in monitors.iter() {
+ println!(" {}. {:?}", monitor.id(), monitor);
+ }
+ }
+ }
+ return Ok(());
+ }
+ },
+ Command::Audio { subcommand } => match subcommand {
+ AudioCommand::List { output } => {
+ let devices = list_audio_devices().await?;
+ match output {
+ OutputFormat::Json => {
+ println!(
+ "{}",
+ serde_json::to_string_pretty(&json!({
+ "data": devices.iter().map(|d| {
+ json!({
+ "name": d.name,
+ "device_type": d.device_type,
+ })
+ }).collect::<Vec<_>>(),
+ "success": true
+ }))?
+ );
+ }
+ OutputFormat::Text => {
+ println!("available audio devices:");
+ for device in devices.iter() {
+ println!(" {:?}", device);
+ }
+ }
+ }
+ return Ok(());
+ }
+ },
#[allow(unused_variables)]
Command::Setup { enable_beta } => {
#[cfg(feature = "beta")]
diff --git a/screenpipe-server/src/cli.rs b/screenpipe-server/src/cli.rs
index b8025542a..1c2682240 100644
--- a/screenpipe-server/src/cli.rs
+++ b/screenpipe-server/src/cli.rs
@@ -145,8 +145,9 @@ pub struct Cli {
#[arg(short = 'r', long)]
pub realtime_audio_device: Vec<String>,
- /// List available audio devices
+ /// List available audio devices (deprecated: use 'audio list' instead)
#[arg(long)]
+ #[deprecated(since = "0.2.30", note = "please use 'audio list' instead")]
pub list_audio_devices: bool,
/// Data directory. Default to $HOME/.screenpipe
@@ -188,8 +189,9 @@ pub struct Cli {
)]
pub ocr_engine: CliOcrEngine,
- /// List available monitors, then you can use --monitor-id to select one (with the ID)
+ /// List available monitors (deprecated: use 'vision list' instead)
#[arg(long)]
+ #[deprecated(since = "0.2.30", note = "please use 'vision list' instead")]
pub list_monitors: bool,
/// Monitor IDs to use, these will be used to select the monitors to record
@@ -294,6 +296,16 @@ pub enum Command {
#[command(subcommand)]
subcommand: PipeCommand,
},
+ /// Vision device management commands
+ Vision {
+ #[command(subcommand)]
+ subcommand: VisionCommand,
+ },
+ /// Audio device management commands
+ Audio {
+ #[command(subcommand)]
+ subcommand: AudioCommand,
+ },
/// Add video files to existing screenpipe data (OCR only) - DOES NOT SUPPORT AUDIO
Add {
/// Path to folder containing video files
@@ -343,7 +355,6 @@ pub enum Command {
},
}
-
#[derive(Subcommand)]
pub enum PipeCommand {
/// List all pipes
@@ -437,6 +448,26 @@ pub enum PipeCommand {
},
}
+#[derive(Subcommand)]
+pub enum VisionCommand {
+ /// List available vision devices (monitors)
+ List {
+ /// Output format
+ #[arg(short, long, value_enum, default_value_t = OutputFormat::Text)]
+ output: OutputFormat,
+ },
+}
+
+#[derive(Subcommand)]
+pub enum AudioCommand {
+ /// List available audio devices
+ List {
+ /// Output format
+ #[arg(short, long, value_enum, default_value_t = OutputFormat::Text)]
+ output: OutputFormat,
+ },
+}
+
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum OutputFormat {
Text,