use reqwest::Client; #[allow(dead_code)] pub struct Scrobbler { pub lastfm_api_key: Option, pub lastfm_api_secret: Option, pub lastfm_session_key: Option, pub listenbrainz_token: Option, client: Client, } #[allow(dead_code)] impl Scrobbler { pub fn new( lastfm_api_key: Option, lastfm_api_secret: Option, lastfm_session_key: Option, listenbrainz_token: Option, ) -> Self { Scrobbler { lastfm_api_key, lastfm_api_secret, lastfm_session_key, listenbrainz_token, client: Client::new(), } } pub fn now_playing(&self, artist: &str, track: &str, album: Option<&str>) { if let Some(api_key) = &self.lastfm_api_key { let _ = self.send_lastfm_now_playing(api_key, artist, track, album); } } pub fn scrobble(&self, artist: &str, track: &str, album: Option<&str>, timestamp: u64) { if let Some(api_key) = &self.lastfm_api_key { let _ = self.send_lastfm_scrobble(api_key, artist, track, album, timestamp); } if let Some(token) = &self.listenbrainz_token { let _ = self.send_listenbrainz_scrobble(token, artist, track, album, timestamp); } } fn send_lastfm_now_playing( &self, _api_key: &str, _artist: &str, _track: &str, _album: Option<&str>, ) -> Result<(), Box> { Ok(()) } fn send_lastfm_scrobble( &self, _api_key: &str, _artist: &str, _track: &str, _album: Option<&str>, _timestamp: u64, ) -> Result<(), Box> { Ok(()) } fn send_listenbrainz_scrobble( &self, _token: &str, _artist: &str, _track: &str, _album: Option<&str>, _timestamp: u64, ) -> Result<(), Box> { Ok(()) } }