From eb8d9ad294e69234107976d8169f6a02cc25adfc Mon Sep 17 00:00:00 2001 From: Henrik Friedrichsen Date: Tue, 27 Jul 2021 23:04:00 +0200 Subject: [PATCH] Fix notify/cover platform config --- src/queue.rs | 5 +++-- src/ui/cover.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/queue.rs b/src/queue.rs index 308212c..d7ff6cb 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -411,7 +411,7 @@ impl Queue { } pub fn send_notification(track_name: &str, cover_url: Option) { - #[cfg(feature = "cover")] + #[cfg(all(feature = "notify", feature = "cover"))] let res = if let Some(u) = cover_url { // download album cover image let path = ui::cover::cache_path_for_url(u.to_string()); @@ -430,9 +430,10 @@ pub fn send_notification(track_name: &str, cover_url: Option) { Notification::new().summary(track_name).show() }; - #[cfg(not(feature = "cover"))] + #[cfg(all(feature = "notify", not(feature = "cover")))] let res = Notification::new().summary(track_name).show(); + #[cfg(feature = "notify")] if let Err(e) = res { error!("Failed to send notification cover: {}", e); } diff --git a/src/ui/cover.rs b/src/ui/cover.rs index 2a407da..2e809ab 100644 --- a/src/ui/cover.rs +++ b/src/ui/cover.rs @@ -292,8 +292,8 @@ impl ViewExt for CoverView { pub fn cache_path_for_url(url: String) -> PathBuf { let mut path = crate::config::cache_path("covers"); - path.push(url.split("/").last().unwrap()); - return path; + path.push(url.split('/').last().unwrap()); + path } pub fn download(url: String, path: PathBuf) -> Result<(), std::io::Error> {