allow disabling the genhtml command, error if no extractors are enabled
This commit is contained in:
parent
3dcd04a9fb
commit
9ef3aa46bd
16
Cargo.toml
16
Cargo.toml
|
@ -37,8 +37,8 @@ metaflac = { version = "0.2", optional = true }
|
|||
taglib = { path = "./modules/taglib", optional = true }
|
||||
|
||||
# for genhtml command
|
||||
html-escape = "0.2"
|
||||
urlencoding = "2"
|
||||
html-escape = { version = "0.2", optional = true }
|
||||
urlencoding = { version = "2", optional = true }
|
||||
|
||||
# error handling
|
||||
thiserror = "1"
|
||||
|
@ -51,10 +51,18 @@ tempfile = "3"
|
|||
notify = "6"
|
||||
|
||||
[features]
|
||||
default = ["taglib_extractor", "flac_extractor", "mp3_extractor", "ffprobe_extractor"]
|
||||
default = [
|
||||
"mp3_extractor",
|
||||
"flac_extractor",
|
||||
"taglib_extractor",
|
||||
"ffprobe_extractor",
|
||||
"command_genhtml"
|
||||
]
|
||||
|
||||
# Formats
|
||||
taglib_extractor = ["dep:taglib"]
|
||||
flac_extractor = ["dep:metaflac"]
|
||||
mp3_extractor = ["dep:id3"]
|
||||
ffprobe_extractor = [] # If to allow using ffmpeg/ffprobe as a fallback tag extractor
|
||||
ffprobe_extractor = [] # If to allow using ffmpeg/ffprobe as a fallback tag extractor
|
||||
|
||||
command_genhtml = ["dep:html-escape", "dep:urlencoding"]
|
|
@ -12,6 +12,7 @@ pub struct CLIArgs {
|
|||
#[derive(Debug, Clone, Subcommand)]
|
||||
pub enum Commands {
|
||||
Process(commands::process::ProcessCommandArgs),
|
||||
#[cfg(feature = "command_genhtml")]
|
||||
Genhtml(commands::genhtml::GenHTMLCommandArgs),
|
||||
Transcode(commands::transcode::TranscodeCommandArgs),
|
||||
Copy(commands::copy::CopyCommandArgs),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
pub mod copy;
|
||||
#[cfg(feature = "command_genhtml")]
|
||||
pub mod genhtml;
|
||||
pub mod process;
|
||||
pub mod tags;
|
||||
|
|
|
@ -16,6 +16,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
Commands::Process(subcommand_args) => {
|
||||
return commands::process::process_command(cli, &subcommand_args);
|
||||
}
|
||||
#[cfg(feature = "command_genhtml")]
|
||||
Commands::Genhtml(subcommand_args) => {
|
||||
return commands::genhtml::genhtml_command(cli, &subcommand_args);
|
||||
}
|
||||
|
|
|
@ -6,14 +6,18 @@ use lazy_static::lazy_static;
|
|||
|
||||
use super::{BoxedError, FormatHandler};
|
||||
|
||||
#[cfg(feature = "ffprobe_extractor")]
|
||||
mod ffprobe;
|
||||
#[cfg(feature = "flac_extractor")]
|
||||
mod flac;
|
||||
#[cfg(feature = "mp3_extractor")]
|
||||
mod id3;
|
||||
#[cfg(feature = "flac_extractor")]
|
||||
mod flac;
|
||||
#[cfg(feature = "taglib_extractor")]
|
||||
mod taglib;
|
||||
#[cfg(feature = "ffprobe_extractor")]
|
||||
mod ffprobe;
|
||||
|
||||
|
||||
#[cfg(not(any(feature = "mp3_extractor", feature = "flac_extractor", feature = "taglib_extractor", feature = "ffprobe_extractor")))]
|
||||
compile_error!("at least one extractor feature must be enabled");
|
||||
|
||||
type NewHandlerFuncReturn = Result<Box<dyn FormatHandler>, BoxedError>;
|
||||
type NewHandlerFunc = fn(path: &PathBuf, file_format: Option<FileFormat>) -> NewHandlerFuncReturn;
|
||||
|
|
Loading…
Reference in a new issue