Add more options
This commit is contained in:
parent
6910bc5ead
commit
bd659cd2d9
2 changed files with 17 additions and 2 deletions
|
@ -132,4 +132,19 @@ pub struct Arguments {
|
||||||
/// Link the program with cmus, if the cmus are not running, the program will exit.
|
/// Link the program with cmus, if the cmus are not running, the program will exit.
|
||||||
#[arg(short = 'l', long)]
|
#[arg(short = 'l', long)]
|
||||||
pub link: bool,
|
pub link: bool,
|
||||||
|
/// Force the program to use the external cover file, if available, and not even try to get the cover from the track's metadata.
|
||||||
|
/// this is useful if you have a cover file with a better quality than the cover in the track's metadata.
|
||||||
|
#[arg(short = 'u', long)]
|
||||||
|
pub force_use_external_cover: bool,
|
||||||
|
#[cfg(feature = "lyrics")]
|
||||||
|
/// Fotrce the program to use the external lyrics file, if available, and not even try to get the lyrics from the track's metadata.
|
||||||
|
#[arg(short = 'm', long)]
|
||||||
|
pub force_use_external_lyrics: bool,
|
||||||
|
/// No use the external cover file, even if it's available and the track's metadata doesn't have a cover.
|
||||||
|
#[arg(short = 'n', long)]
|
||||||
|
pub no_use_external_cover: bool,
|
||||||
|
#[cfg(feature = "lyrics")]
|
||||||
|
/// No use the external lyrics file, even if it's available and the track's metadata doesn't have a lyrics.
|
||||||
|
#[arg(short = 'o', long)]
|
||||||
|
pub no_use_external_lyrics: bool,
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ 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, 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,7 +116,7 @@ pub fn track_cover(track_path: &str, force_use_external_cover: bool, no_use_exte
|
||||||
}
|
}
|
||||||
|
|
||||||
if !no_use_external_cover {
|
if !no_use_external_cover {
|
||||||
if let Ok(Some(cover)) = search_for(track_path, 2,
|
if let Ok(Some(cover)) = search_for(track_path, max_depth,
|
||||||
®ex::Regex::new(r".*\.(jpg|jpeg|png|gif)$").unwrap()) {
|
®ex::Regex::new(r".*\.(jpg|jpeg|png|gif)$").unwrap()) {
|
||||||
return TrackCover::External(cover);
|
return TrackCover::External(cover);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue