add feature for toggling replaygain support
This commit is contained in:
parent
96117c2faf
commit
9a83845831
|
@ -52,6 +52,7 @@ notify = "6"
|
|||
|
||||
[features]
|
||||
default = [
|
||||
"replaygain",
|
||||
"mp3_extractor",
|
||||
"flac_extractor",
|
||||
"taglib_extractor",
|
||||
|
@ -66,3 +67,5 @@ mp3_extractor = ["dep:id3"]
|
|||
ffprobe_extractor = [] # If to allow using ffmpeg/ffprobe as a fallback tag extractor
|
||||
|
||||
command_genhtml = ["dep:html-escape", "dep:urlencoding"]
|
||||
|
||||
replaygain = []
|
|
@ -7,6 +7,7 @@ use crate::types::AudioFileInfo;
|
|||
use crate::types::File;
|
||||
use crate::utils::ascii_reduce::reduce_to_ascii;
|
||||
use crate::utils::formats::get_format_handler;
|
||||
#[cfg(feature = "replaygain")]
|
||||
use crate::utils::replaygain::analyze_replaygain;
|
||||
use crate::utils::scan_for_music;
|
||||
|
||||
|
@ -15,10 +16,13 @@ pub struct ProcessCommandArgs {
|
|||
pub source: String,
|
||||
#[clap(long)]
|
||||
pub dry_run: bool,
|
||||
#[cfg(feature = "replaygain")]
|
||||
#[clap(long)]
|
||||
pub skip_replaygain: bool,
|
||||
#[cfg(feature = "replaygain")]
|
||||
#[clap(long)]
|
||||
pub force_replaygain: bool,
|
||||
#[cfg(feature = "replaygain")]
|
||||
#[clap(long)]
|
||||
pub replaygain_threads: Option<u32>,
|
||||
#[clap(long)]
|
||||
|
@ -112,6 +116,7 @@ fn rename_file(process_args: &ProcessCommandArgs, file: &mut File) {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "replaygain")]
|
||||
pub fn add_replaygain_tags(file: &File, force: bool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
if !file.info.supports_replaygain {
|
||||
println!(
|
||||
|
@ -211,6 +216,7 @@ pub fn process_command(
|
|||
rename_file(process_args, file);
|
||||
}
|
||||
|
||||
#[cfg(feature = "replaygain")]
|
||||
if !process_args.skip_replaygain && !process_args.dry_run {
|
||||
println!("Adding ReplayGain Tags to Files");
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
pub mod ascii_reduce;
|
||||
pub mod ffprobe;
|
||||
pub mod format_detection;
|
||||
#[cfg(feature = "replaygain")]
|
||||
pub mod replaygain;
|
||||
pub mod transcoder;
|
||||
|
||||
|
|
Loading…
Reference in a new issue