mpris proof of concept
This commit is contained in:
commit
813d430af5
4 changed files with 1388 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
1360
Cargo.lock
generated
Normal file
1360
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
11
Cargo.toml
Normal file
11
Cargo.toml
Normal 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
16
src/main.rs
Normal 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!");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue