From 8b70b2b851543c5a499683b615e0a6ef133b61df Mon Sep 17 00:00:00 2001 From: chaos Date: Thu, 19 Oct 2023 16:13:26 +0100 Subject: [PATCH] rename some cargo features --- Cargo.toml | 10 +++++----- src/utils/formats/handlers/mod.rs | 8 ++++---- src/utils/formats/mod.rs | 32 +++++++++++++++---------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 243c8d3..de15f27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,10 +51,10 @@ tempfile = "3" notify = "6" [features] -default = ["taglib", "flac", "mp3", "ffmpeg_fallback"] +default = ["taglib_extractor", "flac_extractor", "mp3_extractor", "ffmpeg_extractor"] # Formats -taglib = ["dep:taglib"] -flac = ["dep:metaflac"] -mp3 = ["dep:id3"] -ffmpeg_fallback = [] # If to allow using ffmpeg as a fallback tag extractor \ No newline at end of file +taglib_extractor = ["dep:taglib"] +flac_extractor = ["dep:metaflac"] +mp3_extractor = ["dep:id3"] +ffmpeg_extractor = [] # If to allow using ffmpeg as a fallback tag extractor \ No newline at end of file diff --git a/src/utils/formats/handlers/mod.rs b/src/utils/formats/handlers/mod.rs index b8afeea..356b9f1 100644 --- a/src/utils/formats/handlers/mod.rs +++ b/src/utils/formats/handlers/mod.rs @@ -1,8 +1,8 @@ -#[cfg(feature = "ffmpeg_fallback")] +#[cfg(feature = "ffmpeg_extractor")] pub mod generic_ffmpeg; -#[cfg(feature = "flac")] +#[cfg(feature = "flac_extractor")] pub mod flac; -#[cfg(feature = "taglib")] +#[cfg(feature = "taglib_extractor")] pub mod generic_taglib; -#[cfg(feature = "mp3")] +#[cfg(feature = "mp3_extractor")] pub mod id3; \ No newline at end of file diff --git a/src/utils/formats/mod.rs b/src/utils/formats/mod.rs index b476c5a..68ecc91 100644 --- a/src/utils/formats/mod.rs +++ b/src/utils/formats/mod.rs @@ -7,13 +7,13 @@ use thiserror::Error; use crate::types::{AudioFileInfo, File, ReplayGainRawData, Tags}; -#[cfg(feature = "flac")] +#[cfg(feature = "flac_extractor")] use self::handlers::flac::new_flac_format_handler; -#[cfg(feature = "taglib")] +#[cfg(feature = "taglib_extractor")] use self::handlers::generic_taglib::new_taglib_format_handler; -#[cfg(feature = "mp3")] +#[cfg(feature = "mp3_extractor")] use self::handlers::id3::new_id3_format_handler; -#[cfg(feature = "ffmpeg_fallback")] +#[cfg(feature = "ffmpeg_extractor")] use self::handlers::generic_ffmpeg::new_generic_ffmpeg_format_handler; use super::format_detection::{detect_format, FileFormat}; @@ -49,7 +49,7 @@ pub fn get_format_handler(file: &File) -> Result, let format = detect_format(&file.join_path_to())?; let path = file.join_path_to(); - #[cfg(feature = "taglib")] + #[cfg(feature = "taglib_extractor")] { match format { FileFormat::OggFLAC @@ -65,19 +65,19 @@ pub fn get_format_handler(file: &File) -> Result, } } - #[cfg(feature = "mp3")] + #[cfg(feature = "mp3_extractor")] if format == FileFormat::MP3 { // Native MP3 support return Ok(Box::new(new_id3_format_handler(&path)?)); } - #[cfg(feature = "flac")] + #[cfg(feature = "flac_extractor")] if format == FileFormat::FLAC { // Native FLAC support return Ok(Box::new(new_flac_format_handler(&path)?)); } - #[cfg(feature = "ffmpeg_fallback")] + #[cfg(feature = "ffmpeg_extractor")] match format { FileFormat::MP3 | FileFormat::FLAC @@ -99,23 +99,23 @@ pub fn get_format_handler(file: &File) -> Result, } fn is_supported_extension(ext: &str) -> bool { - #[cfg(feature = "taglib")] + #[cfg(feature = "taglib_extractor")] if matches!(ext, "ogg" | "opus" | "wav" | "wv" | "aiff") { return true; } - #[cfg(feature = "mp3")] + #[cfg(feature = "mp3_extractor")] if ext == "mp3" { return true; } - #[cfg(feature = "flac")] + #[cfg(feature = "flac_extractor")] if ext == "flac" { return true; } // FFMpeg Fallback - #[cfg(feature = "ffmpeg_fallback")] + #[cfg(feature = "ffmpeg_extractor")] if matches!(ext, "mp3" | "flac" | "ogg" | "opus" | "wav" | "wv" | "aiff") { return true; } @@ -143,7 +143,7 @@ pub fn is_supported_file(file_path: &Path) -> bool { let format = format.unwrap(); - #[cfg(feature = "taglib")] + #[cfg(feature = "taglib_extractor")] match format { FileFormat::OggVorbis | FileFormat::OggOpus @@ -157,17 +157,17 @@ pub fn is_supported_file(file_path: &Path) -> bool { _ => {} } - #[cfg(feature = "mp3")] + #[cfg(feature = "mp3_extractor")] if format == FileFormat::MP3 { return true; } - #[cfg(feature = "flac")] + #[cfg(feature = "flac_extractor")] if format == FileFormat::FLAC { return true; } - #[cfg(feature = "ffmpeg_fallback")] + #[cfg(feature = "ffmpeg_extractor")] match format { FileFormat::MP3 | FileFormat::FLAC