Format the code
This commit is contained in:
parent
339c11253f
commit
25cce99b80
3 changed files with 15 additions and 6 deletions
|
@ -202,7 +202,9 @@ impl Arguments {
|
||||||
if args.show_track_cover == true {
|
if args.show_track_cover == true {
|
||||||
args.show_track_cover = cfg.show_track_cover;
|
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);
|
args.cover_path = args.cover_path.or(cfg.cover_path);
|
||||||
#[cfg(feature = "lyrics")]
|
#[cfg(feature = "lyrics")]
|
||||||
if args.lyrics_path == None {
|
if args.lyrics_path == None {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
|
use cmus_notify::arguments::Arguments;
|
||||||
use cmus_notify::{
|
use cmus_notify::{
|
||||||
arguments,
|
arguments,
|
||||||
cmus::{self, query::CmusQueryResponse, CmusError},
|
cmus::{self, query::CmusQueryResponse, CmusError},
|
||||||
};
|
};
|
||||||
use cmus_notify::arguments::Arguments;
|
|
||||||
|
|
||||||
macro_rules! sleep {
|
macro_rules! sleep {
|
||||||
($time: expr) => {
|
($time: expr) => {
|
||||||
|
|
15
src/lib.rs
15
src/lib.rs
|
@ -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 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.
|
/// If the track has an embedded cover, and `force_use_external_cover` is `true`, the function will search for an external cover.
|
||||||
#[inline]
|
#[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 !force_use_external_cover {
|
||||||
if let Ok(Some(cover)) = get_embedded_art(track_path) {
|
if let Ok(Some(cover)) = get_embedded_art(track_path) {
|
||||||
return TrackCover::Embedded(cover);
|
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 !no_use_external_cover {
|
||||||
if let Ok(Some(cover)) = search_for(track_path, max_depth,
|
if let Ok(Some(cover)) = search_for(
|
||||||
®ex::Regex::new(r".*\.(jpg|jpeg|png|gif)$").unwrap()) {
|
track_path,
|
||||||
|
max_depth,
|
||||||
|
®ex::Regex::new(r".*\.(jpg|jpeg|png|gif)$").unwrap(),
|
||||||
|
) {
|
||||||
return TrackCover::External(cover);
|
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
|
TrackCover::None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn search(search_directory: &str, matcher: ®ex::Regex) -> std::io::Result<Option<String>> {
|
fn search(search_directory: &str, matcher: ®ex::Regex) -> std::io::Result<Option<String>> {
|
||||||
for entry in std::fs::read_dir(search_directory)? {
|
for entry in std::fs::read_dir(search_directory)? {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue