Format the code

This commit is contained in:
Anas Elgarhy 2023-02-13 01:59:15 +02:00
parent 339c11253f
commit 25cce99b80
No known key found for this signature in database
GPG key ID: 0501802A1D496528
3 changed files with 15 additions and 6 deletions

View file

@ -202,7 +202,9 @@ impl Arguments {
if args.show_track_cover == true {
args.show_track_cover = cfg.show_track_cover;
}
args.notification_static_icon = args.notification_static_icon.or(cfg.notification_static_icon);
args.notification_static_icon = args
.notification_static_icon
.or(cfg.notification_static_icon);
args.cover_path = args.cover_path.or(cfg.cover_path);
#[cfg(feature = "lyrics")]
if args.lyrics_path == None {

View file

@ -1,10 +1,10 @@
use clap::Parser;
use cmus_notify::arguments::Arguments;
use cmus_notify::{
arguments,
cmus::{self, query::CmusQueryResponse, CmusError},
};
use cmus_notify::arguments::Arguments;
macro_rules! sleep {
($time: expr) => {

View file

@ -108,7 +108,12 @@ pub enum TrackCover {
/// If the track does not have an embedded cover, and `no_use_external_cover` is `false`, the function will search for an external cover.
/// If the track has an embedded cover, and `force_use_external_cover` is `true`, the function will search for an external cover.
#[inline]
pub fn track_cover(track_path: &str, max_depth: u8, force_use_external_cover: bool, no_use_external_cover: bool) -> TrackCover {
pub fn track_cover(
track_path: &str,
max_depth: u8,
force_use_external_cover: bool,
no_use_external_cover: bool,
) -> TrackCover {
if !force_use_external_cover {
if let Ok(Some(cover)) = get_embedded_art(track_path) {
return TrackCover::Embedded(cover);
@ -116,8 +121,11 @@ pub fn track_cover(track_path: &str, max_depth: u8, force_use_external_cover: bo
}
if !no_use_external_cover {
if let Ok(Some(cover)) = search_for(track_path, max_depth,
&regex::Regex::new(r".*\.(jpg|jpeg|png|gif)$").unwrap()) {
if let Ok(Some(cover)) = search_for(
track_path,
max_depth,
&regex::Regex::new(r".*\.(jpg|jpeg|png|gif)$").unwrap(),
) {
return TrackCover::External(cover);
}
}
@ -125,7 +133,6 @@ pub fn track_cover(track_path: &str, max_depth: u8, force_use_external_cover: bo
TrackCover::None
}
#[inline]
fn search(search_directory: &str, matcher: &regex::Regex) -> std::io::Result<Option<String>> {
for entry in std::fs::read_dir(search_directory)? {