mpris: Add helper for enumerating players, watching for new players (#12)
This commit is contained in:
parent
8b9767f6ce
commit
c81f428ace
6 changed files with 93 additions and 12 deletions
16
mpris2/examples/enumerate.rs
Normal file
16
mpris2/examples/enumerate.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use futures_util::stream::StreamExt;
|
||||
use mpris2_zbus::enumerator::Enumerator;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> zbus::Result<()> {
|
||||
let connection = zbus::Connection::session().await?;
|
||||
let enumerator = Enumerator::new(&connection).await?;
|
||||
let mut stream = enumerator.receive_changes().await?;
|
||||
println!("players: {:?}", enumerator.players().await?);
|
||||
while let Some(event) = stream.next().await {
|
||||
println!("change: {:?}", event?);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue