1
Fork 0

mpris proof of concept

This commit is contained in:
Andy Killorin 2023-10-28 19:23:38 -05:00
commit 813d430af5
Signed by: ank
GPG key ID: B6241CA3B552BCA4
4 changed files with 1388 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

1360
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

11
Cargo.toml Normal file
View file

@ -0,0 +1,11 @@
[package]
name = "funring"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.75"
mpris = "2.0.1"
tray-icon = "0.10.0"

16
src/main.rs Normal file
View file

@ -0,0 +1,16 @@
use mpris::PlayerFinder;
use anyhow::Result;
fn main() -> Result<()> {
let pf = PlayerFinder::new()?;
let players = pf.find_all()?;
let mut tracker = players[0].track_progress(500)?;
println!("Hello, {}!", players[0].identity());
loop {
let tick = tracker.tick();
let elapsed = tick.progress.position().as_secs();
let total = tick.progress.length().unwrap().as_secs();
println!("{elapsed}s/{total}s!");
}
}