use std::io::Result; use mpris::PlayerFinder; use crate::Track; use super::LyricsSource; pub struct Dbus; impl Dbus { pub fn new() -> Self { Dbus } } impl LyricsSource for Dbus { fn name(&self) -> String { "dbus".to_string() } fn current_track(&self) -> Option { let player = PlayerFinder::new().ok()? .find_active().ok()?; let metadata = player.get_metadata().ok()?; let name = metadata.title()?.to_string(); let artists = metadata.artists()?; let artist = artists.get(0)?.to_string(); Some(Track { name, artist }) } fn disable(&self) -> Result<()> { Ok(()) } fn enable(&self) -> Result<()> { Ok(()) } fn reset(&self) -> Result<()> { Ok(()) } }