mpris: Add helper for enumerating players, watching for new players (#12)

This commit is contained in:
Ian Douglas Scott 2024-04-03 18:32:12 -07:00 committed by GitHub
parent 8b9767f6ce
commit c81f428ace
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 93 additions and 12 deletions

View 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(())
}