]> git.r.bdr.sh - rbdr/lyricli/blame_incremental - src/sources/dbus.rs
Remove the openssl stuff
[rbdr/lyricli] / src / sources / dbus.rs
... / ...
CommitLineData
1use std::io::Result;
2use mpris::PlayerFinder;
3
4use crate::Track;
5
6use super::LyricsSource;
7
8pub struct Dbus;
9
10impl Dbus {
11 pub fn new() -> Self {
12 Dbus
13 }
14}
15
16impl LyricsSource for Dbus {
17
18 fn name(&self) -> String {
19 "dbus".to_string()
20 }
21
22 fn current_track(&self) -> Option<Track> {
23 let player = PlayerFinder::new().ok()?
24 .find_active().ok()?;
25
26 let metadata = player.get_metadata().ok()?;
27 let name = metadata.title()?.to_string();
28 let artists = metadata.artists()?;
29 let artist = artists.get(0)?.to_string();
30
31 Some(Track {
32 name,
33 artist
34 })
35 }
36
37 fn disable(&self) -> Result<()> {
38 Ok(())
39 }
40
41 fn enable(&self) -> Result<()> {
42 Ok(())
43 }
44
45 fn reset(&self) -> Result<()> {
46 Ok(())
47 }
48}