diff --git a/Cargo.lock b/Cargo.lock index 8a0234a..82f7fdb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,15 +190,6 @@ dependencies = [ "terminal_size", ] -[[package]] -name = "clap-markdown" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325f50228f76921784b6d9f2d62de6778d834483248eefecd27279174797e579" -dependencies = [ - "clap", -] - [[package]] name = "clap_derive" version = "4.1.0" @@ -226,7 +217,6 @@ name = "cmus-notify" version = "0.1.0" dependencies = [ "clap", - "clap-markdown", "confy", "id3", "image", diff --git a/src/lib.rs b/src/lib.rs index 44c337b..4831470 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -184,11 +184,7 @@ pub fn track_cover( }; #[cfg(feature = "debug")] info!("Trying to get the external cover of \"{path}\"."); - if let Ok(Some(cover)) = search_for( - &path, - max_depth, - ®x, - ) { + if let Ok(Some(cover)) = search_for(&path, max_depth, ®x) { #[cfg(feature = "debug")] info!("Found the external cover \"{cover}\"."); return TrackCover::External(cover); @@ -233,10 +229,10 @@ pub fn process_template_placeholders( #[cfg(test)] mod tests { use super::*; + use crate::cmus::player_settings::PlayerSettings; use std::assert_matches::assert_matches; use std::str::FromStr; use test_context::{test_context, TestContext}; - use crate::cmus::player_settings::PlayerSettings; struct TestContextWithFullTrack { track: Track, @@ -262,7 +258,8 @@ mod tests { #[test] fn test_process_path_template(ctx: &TestContextWithFullTrack) { let cover_path_template = String::from("{title}/{artist}/{album}/{tracknumber}"); - let cover_path = process_template_placeholders(cover_path_template, &ctx.track, &ctx.player_settings); + let cover_path = + process_template_placeholders(cover_path_template, &ctx.track, &ctx.player_settings); assert_eq!( cover_path, diff --git a/src/notification.rs b/src/notification.rs index 906c572..8e1c6bf 100644 --- a/src/notification.rs +++ b/src/notification.rs @@ -102,9 +102,7 @@ impl NotificationsHandler { // Reset the notification self.setup_the_notification(); let path = match &self.settings.cover_path_template { - Some(template) => { - track.process(template.clone()) - } + Some(template) => track.process(template.clone()), None => track.path.clone(), }; // Get the track cover and set it to notification @@ -140,14 +138,17 @@ impl NotificationsHandler { #[inline(always)] fn setup_notification_timeout(&mut self, event: &CmusEvent) { use CmusEvent::*; - self.notification.timeout(match event { - TrackChanged(_, _) => self.settings.timeout(), - StatusChanged(_, _) => self.settings.status_notification_timeout(), - AAAMode(_, _) => self.settings.aaa_mode_notification_timeout(), - VolumeChanged(_, _) => self.settings.volume_notification_timeout(), - RepeatChanged(_, _) => self.settings.repeat_notification_timeout(), - ShuffleChanged(_, _) => self.settings.shuffle_notification_timeout(), - _ => self.settings.timeout(), - } as i32 * 1000); + self.notification.timeout( + match event { + TrackChanged(_, _) => self.settings.timeout(), + StatusChanged(_, _) => self.settings.status_notification_timeout(), + AAAMode(_, _) => self.settings.aaa_mode_notification_timeout(), + VolumeChanged(_, _) => self.settings.volume_notification_timeout(), + RepeatChanged(_, _) => self.settings.repeat_notification_timeout(), + ShuffleChanged(_, _) => self.settings.shuffle_notification_timeout(), + _ => self.settings.timeout(), + } as i32 + * 1000, + ); } }