]> git.r.bdr.sh - rbdr/lyricli/blob - src/sources/dbus.rs
Remove the openssl stuff
[rbdr/lyricli] / src / sources / dbus.rs
1 use std::io::Result;
2 use mpris::PlayerFinder;
3
4 use crate::Track;
5
6 use super::LyricsSource;
7
8 pub struct Dbus;
9
10 impl Dbus {
11 pub fn new() -> Self {
12 Dbus
13 }
14 }
15
16 impl 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 }