Add list-all mpris functionality
This commit is contained in:
parent
e38c570f43
commit
4559d72ffd
3 changed files with 34 additions and 4 deletions
18
Cargo.lock
generated
18
Cargo.lock
generated
|
@ -59,6 +59,12 @@ dependencies = [
|
|||
"syn 0.11.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
|
||||
[[package]]
|
||||
name = "enum-kinds"
|
||||
version = "0.5.1"
|
||||
|
@ -112,6 +118,15 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.147"
|
||||
|
@ -141,9 +156,10 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "picoKontroller"
|
||||
name = "pico_kontroller"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"mpris",
|
||||
]
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
[package]
|
||||
name = "picoKontroller"
|
||||
name = "pico_kontroller"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
itertools = "0.11.0"
|
||||
mpris = "2.0.1"
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -1,3 +1,16 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use itertools::Itertools;
|
||||
use mpris::PlayerFinder;
|
||||
fn list_all_mpris() {
|
||||
PlayerFinder::new()
|
||||
.expect("Could not connect to D-Bus")
|
||||
.find_all()
|
||||
.unwrap_or_else(|_| Vec::new())
|
||||
.into_iter()
|
||||
.map(|player| player.identity().to_string())
|
||||
.unique()
|
||||
.for_each(|player| println!("{}", player));
|
||||
}
|
||||
|
||||
fn main() {
|
||||
list_all_mpris();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue