2UOBRVHKPWOZWPMU3PMZ3Z6KRN25FWYOOZZ5M4VHK2HUSCKPPOCAC
U6GAST4QSK5XN53QTNFR6ZKP65I5VUFTIH2AHB6EVKJTSWBKJDBQC
2OEKDJGNRB26WDYNIPXLD3X5KFEXUQN2EACBXO6T4F5PPB3YL2TQC
CJ3W6DCERC3FVMB7FJOA2V5MTAHHORYOEJB3J5HFJ5PFBVK2UXWQC
QNAL26AOMT5LCCJW7JIV52HLKE4UD4PTNZAMMFYVVOFGQXL4BPBAC
O7LARFJLYA7QBV73LE6N3DWVVKHCE43LI6EMCD34AXYHP6M5PWDQC
6GZTCB6VJEBACZR2KCGIXBOQ3JFHTBJQJNPAGQNNWQFDB6VRFEUAC
let (media_controls, media_events) = {
let config = souvlaki::PlatformConfig {
dbus_name: "tunefire",
display_name: "Tunefire",
hwnd: None,
};
let mut controls = MediaControls::new(config).unwrap();
let (to_handler, from_media_events) = std::sync::mpsc::sync_channel(32);
controls
.attach(move |e| {
to_handler.send(e).ok();
})
.unwrap();
(controls, from_media_events)
};
}
pub fn update_media_controls(&mut self, data: &State) {
use souvlaki::{MediaMetadata, MediaPlayback, MediaPosition};
match &data.current_song {
Some(song) => {
self.media_controls
.set_metadata(MediaMetadata {
title: Some(song.title.as_str()),
..Default::default()
})
.ok();
self.media_controls
.set_playback(MediaPlayback::Playing {
progress: Some(MediaPosition(Duration::from_secs(1))),
})
.ok();
}
None => {
self.media_controls
.set_metadata(MediaMetadata::default())
.ok();
self.media_controls
.set_playback(MediaPlayback::Stopped)
.ok();
}
}
souvlaki = "0.5.1"
name = "dbus"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f8bcdd56d2e5c4ed26a529c5a9029f5db8290d433497506f958eae3be148eb6"
dependencies = [
"libc",
"libdbus-sys",
"winapi",
]
[[package]]
name = "dbus-crossroads"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "554114296d012b33fdaf362a733db6dc5f73c4c9348b8b620ddd42e61b406e30"
dependencies = [
"dbus",
]
[[package]]
name = "raw-window-handle"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76"
dependencies = [
"libc",
"raw-window-handle 0.4.3",
]
[[package]]
name = "raw-window-handle"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41"
dependencies = [
"cty",
]
[[package]]
name = "souvlaki"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "007734f0cdbd156d0e1819f8cb1161749fa1ff8070f466509c2514b142e48feb"
dependencies = [
"block",
"cocoa",
"core-graphics",
"dbus",
"dbus-crossroads",
"dispatch",
"objc",
"raw-window-handle 0.3.4",
"windows",
]
[[package]]
name = "windows"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aac7fef12f4b59cd0a29339406cc9203ab44e440ddff6b3f5a41455349fa9cf3"
dependencies = [
"windows_aarch64_msvc 0.29.0",
"windows_i686_gnu 0.29.0",
"windows_i686_msvc 0.29.0",
"windows_x86_64_gnu 0.29.0",
"windows_x86_64_msvc 0.29.0",
]
[[package]]
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_msvc",
"windows_aarch64_msvc 0.36.1",
"windows_i686_gnu 0.36.1",
"windows_i686_msvc 0.36.1",
"windows_x86_64_gnu 0.36.1",
"windows_x86_64_msvc 0.36.1",