Add NoEvents
error for CmusQueryResponse
This commit is contained in:
parent
6d62c66b5f
commit
4773c1c1cd
3 changed files with 3 additions and 7 deletions
|
@ -54,6 +54,8 @@ pub enum CmusError {
|
||||||
UnknownAAAMode(String),
|
UnknownAAAMode(String),
|
||||||
#[error("Unknown shuffle mode: {0}")]
|
#[error("Unknown shuffle mode: {0}")]
|
||||||
UnknownShuffleMode(String),
|
UnknownShuffleMode(String),
|
||||||
|
#[error("No events")]
|
||||||
|
NoEvents,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for TrackStatus {
|
impl FromStr for TrackStatus {
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl CmusQueryResponse {
|
||||||
if self.track_row.is_empty() || self.player_settings_row.is_empty() {
|
if self.track_row.is_empty() || self.player_settings_row.is_empty() {
|
||||||
#[cfg(feature = "debug")]
|
#[cfg(feature = "debug")]
|
||||||
info!("Cmus response is empty, returning empty events");
|
info!("Cmus response is empty, returning empty events");
|
||||||
return Ok(Vec::new());
|
return Err(CmusError::NoEvents)
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut events = Vec::new();
|
let mut events = Vec::new();
|
||||||
|
|
|
@ -30,12 +30,6 @@ impl NotificationsHandler {
|
||||||
events: Vec<CmusEvent>,
|
events: Vec<CmusEvent>,
|
||||||
response: &CmusQueryResponse,
|
response: &CmusQueryResponse,
|
||||||
) -> Result<(), notify_rust::error::Error> {
|
) -> 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.
|
//FIXME: Should check if the user has enabled the cover feature or use a static cover.
|
||||||
self.update_cover(&events[0], response);
|
self.update_cover(&events[0], response);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue