Implement the entities subcommand of the pa_volume handler
This commit is contained in:
parent
95f34add08
commit
96451e3c91
2 changed files with 17 additions and 2 deletions
|
@ -1,7 +1,6 @@
|
||||||
# Deckster
|
# Deckster
|
||||||
|
|
||||||
## To do
|
## To do
|
||||||
- Make the CLI of handlers more useful
|
|
||||||
- Make the `playerctl` handler independent of… playerctl. Use the [`mpris` crate](https://lib.rs/crates/mpris) directly instead.
|
- Make the `playerctl` handler independent of… playerctl. Use the [`mpris` crate](https://lib.rs/crates/mpris) directly instead.
|
||||||
- Implement scrolling
|
- Implement scrolling
|
||||||
- Move loupedeck_serial and pa_volume_interface out of this repository.
|
- Move loupedeck_serial and pa_volume_interface out of this repository.
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
|
use pa_volume_interface::PaVolumeInterface;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::thread::sleep;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use crate::handler::Handler;
|
use crate::handler::Handler;
|
||||||
|
|
||||||
|
@ -19,7 +23,7 @@ fn main() -> Result<()> {
|
||||||
let command = CliCommand::parse();
|
let command = CliCommand::parse();
|
||||||
|
|
||||||
match command {
|
match command {
|
||||||
CliCommand::Entities => todo!(),
|
CliCommand::Entities => print_entities(),
|
||||||
CliCommand::Run => {
|
CliCommand::Run => {
|
||||||
deckster_mode::run(Handler::new)?;
|
deckster_mode::run(Handler::new)?;
|
||||||
}
|
}
|
||||||
|
@ -27,3 +31,15 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn print_entities() {
|
||||||
|
let pa_volume_interface = Arc::new(PaVolumeInterface::spawn_thread("deckster handler".to_owned()));
|
||||||
|
sleep(Duration::from_secs(1)); // wait for the data to load
|
||||||
|
|
||||||
|
let full_state = pa_volume_interface.current_state();
|
||||||
|
let entities_by_id = full_state.entities_by_id();
|
||||||
|
|
||||||
|
for (id, state) in entities_by_id {
|
||||||
|
println!("{id}: {:#?}\n", state.metadata());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue