diff --git a/src/cmus/mod.rs b/src/cmus/mod.rs index 26762f1..164bbfa 100644 --- a/src/cmus/mod.rs +++ b/src/cmus/mod.rs @@ -54,6 +54,8 @@ pub enum CmusError { UnknownAAAMode(String), #[error("Unknown shuffle mode: {0}")] UnknownShuffleMode(String), + #[error("No events")] + NoEvents, } impl FromStr for TrackStatus { diff --git a/src/cmus/query.rs b/src/cmus/query.rs index eea1b0d..5f09a35 100644 --- a/src/cmus/query.rs +++ b/src/cmus/query.rs @@ -51,7 +51,7 @@ impl CmusQueryResponse { if self.track_row.is_empty() || self.player_settings_row.is_empty() { #[cfg(feature = "debug")] info!("Cmus response is empty, returning empty events"); - return Ok(Vec::new()); + return Err(CmusError::NoEvents) } let mut events = Vec::new(); diff --git a/src/notification.rs b/src/notification.rs index 1eb8b99..324f448 100644 --- a/src/notification.rs +++ b/src/notification.rs @@ -30,12 +30,6 @@ impl NotificationsHandler { events: Vec, response: &CmusQueryResponse, ) -> Result<(), notify_rust::error::Error> { - if events.is_empty() { - #[cfg(feature = "debug")] - info!("no events to process"); - return Ok(()); // No events to process. - } - //FIXME: Should check if the user has enabled the cover feature or use a static cover. self.update_cover(&events[0], response);