change default formatting to use tabs instead of spaces
This commit is contained in:
parent
1dc74c2cb0
commit
2f5f493f9b
2
.rustfmt.toml
Normal file
2
.rustfmt.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
hard_tabs = true
|
||||||
|
use_field_init_shorthand = true
|
|
@ -1,12 +1,8 @@
|
||||||
mod ffprobe_output;
|
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
|
mod ffprobe_output;
|
||||||
pub mod types;
|
pub mod types;
|
||||||
|
|
||||||
use std::{
|
use std::{convert::Into, path::Path, process::Command};
|
||||||
convert::Into,
|
|
||||||
path::Path,
|
|
||||||
process::Command,
|
|
||||||
};
|
|
||||||
|
|
||||||
use self::errors::{AnalyzeError, FFProbeError};
|
use self::errors::{AnalyzeError, FFProbeError};
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,9 @@ use std::path::PathBuf;
|
||||||
use crate::{
|
use crate::{
|
||||||
types::{AudioFileInfo, ReplayGainRawData, Tags},
|
types::{AudioFileInfo, ReplayGainRawData, Tags},
|
||||||
utils::format_detection::FileFormat,
|
utils::format_detection::FileFormat,
|
||||||
utils::formats::{FormatHandler, AudioFormatError, BoxedError}
|
utils::formats::{AudioFormatError, BoxedError, FormatHandler},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
pub struct FLACAudioFormat {
|
pub struct FLACAudioFormat {
|
||||||
flac_tags: metaflac::Tag,
|
flac_tags: metaflac::Tag,
|
||||||
path: Box<PathBuf>,
|
path: Box<PathBuf>,
|
||||||
|
|
|
@ -5,7 +5,7 @@ use id3::TagLike;
|
||||||
use crate::{
|
use crate::{
|
||||||
types::{AudioFileInfo, ReplayGainRawData, Tags},
|
types::{AudioFileInfo, ReplayGainRawData, Tags},
|
||||||
utils::format_detection::FileFormat,
|
utils::format_detection::FileFormat,
|
||||||
utils::formats::{FormatHandler, AudioFormatError, BoxedError},
|
utils::formats::{AudioFormatError, BoxedError, FormatHandler},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct ID3AudioFormat {
|
pub struct ID3AudioFormat {
|
||||||
|
|
|
@ -6,14 +6,14 @@ use lazy_static::lazy_static;
|
||||||
|
|
||||||
use super::{BoxedError, FormatHandler};
|
use super::{BoxedError, FormatHandler};
|
||||||
|
|
||||||
#[cfg(feature = "flac_extractor")]
|
|
||||||
mod flac;
|
|
||||||
#[cfg(feature = "ffprobe_extractor")]
|
#[cfg(feature = "ffprobe_extractor")]
|
||||||
mod ffprobe;
|
mod ffprobe;
|
||||||
#[cfg(feature = "taglib_extractor")]
|
#[cfg(feature = "flac_extractor")]
|
||||||
mod taglib;
|
mod flac;
|
||||||
#[cfg(feature = "mp3_extractor")]
|
#[cfg(feature = "mp3_extractor")]
|
||||||
mod id3;
|
mod id3;
|
||||||
|
#[cfg(feature = "taglib_extractor")]
|
||||||
|
mod taglib;
|
||||||
|
|
||||||
type NewHandlerFuncReturn = Result<Box<dyn FormatHandler>, BoxedError>;
|
type NewHandlerFuncReturn = Result<Box<dyn FormatHandler>, BoxedError>;
|
||||||
type NewHandlerFunc = fn(path: &PathBuf, file_format: Option<FileFormat>) -> NewHandlerFuncReturn;
|
type NewHandlerFunc = fn(path: &PathBuf, file_format: Option<FileFormat>) -> NewHandlerFuncReturn;
|
||||||
|
@ -21,7 +21,7 @@ type NewHandlerFunc = fn(path: &PathBuf, file_format: Option<FileFormat>) -> New
|
||||||
pub struct Handler {
|
pub struct Handler {
|
||||||
pub supported_extensions: Vec<String>,
|
pub supported_extensions: Vec<String>,
|
||||||
pub supported_formats: Vec<FileFormat>,
|
pub supported_formats: Vec<FileFormat>,
|
||||||
pub new: NewHandlerFunc
|
pub new: NewHandlerFunc,
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
@ -37,7 +37,6 @@ lazy_static! {
|
||||||
|
|
||||||
extensions
|
extensions
|
||||||
};
|
};
|
||||||
|
|
||||||
pub static ref SUPPORTED_FORMATS: Vec<FileFormat> = {
|
pub static ref SUPPORTED_FORMATS: Vec<FileFormat> = {
|
||||||
let mut formats: Vec<FileFormat> = Vec::new();
|
let mut formats: Vec<FileFormat> = Vec::new();
|
||||||
for handler in HANDLERS.iter() {
|
for handler in HANDLERS.iter() {
|
||||||
|
@ -50,7 +49,6 @@ lazy_static! {
|
||||||
|
|
||||||
formats
|
formats
|
||||||
};
|
};
|
||||||
|
|
||||||
pub static ref HANDLERS: Vec<Handler> = {
|
pub static ref HANDLERS: Vec<Handler> = {
|
||||||
let mut handlers: Vec<Handler> = Vec::new();
|
let mut handlers: Vec<Handler> = Vec::new();
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,9 @@ use taglib::{
|
||||||
use crate::{
|
use crate::{
|
||||||
types::{AudioFileInfo, ReplayGainRawData, Tags},
|
types::{AudioFileInfo, ReplayGainRawData, Tags},
|
||||||
utils::format_detection::FileFormat,
|
utils::format_detection::FileFormat,
|
||||||
utils::formats::{FormatHandler, AudioFormatError, BoxedError}
|
utils::formats::{AudioFormatError, BoxedError, FormatHandler},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
pub struct TaglibAudioFormat {
|
pub struct TaglibAudioFormat {
|
||||||
file: taglib::TagLibFile,
|
file: taglib::TagLibFile,
|
||||||
file_format: Option<FileFormat>,
|
file_format: Option<FileFormat>,
|
||||||
|
@ -75,8 +74,7 @@ impl FormatHandler for TaglibAudioFormat {
|
||||||
FileFormat::OggVorbis
|
FileFormat::OggVorbis
|
||||||
| FileFormat::OggOpus
|
| FileFormat::OggOpus
|
||||||
| FileFormat::OggFLAC
|
| FileFormat::OggFLAC
|
||||||
| FileFormat::OggSpeex
|
| FileFormat::OggSpeex // Both "support" ReplayGain but not implemented yet
|
||||||
// Both "support" ReplayGain but not implemented yet
|
|
||||||
// FileFormat::Wav |
|
// FileFormat::Wav |
|
||||||
// FileFormat::WavPack
|
// FileFormat::WavPack
|
||||||
);
|
);
|
||||||
|
|
|
@ -7,7 +7,6 @@ use thiserror::Error;
|
||||||
|
|
||||||
use crate::types::{AudioFileInfo, File, ReplayGainRawData, Tags};
|
use crate::types::{AudioFileInfo, File, ReplayGainRawData, Tags};
|
||||||
|
|
||||||
|
|
||||||
use super::format_detection::detect_format;
|
use super::format_detection::detect_format;
|
||||||
|
|
||||||
type BoxedError = Box<dyn Error>;
|
type BoxedError = Box<dyn Error>;
|
||||||
|
@ -43,11 +42,11 @@ pub fn get_format_handler(file: &File) -> Result<Box<dyn FormatHandler>, BoxedEr
|
||||||
|
|
||||||
for handler in handlers::HANDLERS.iter() {
|
for handler in handlers::HANDLERS.iter() {
|
||||||
if !handler.supported_extensions.contains(&file.extension) {
|
if !handler.supported_extensions.contains(&file.extension) {
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !handler.supported_formats.contains(&format) {
|
if !handler.supported_formats.contains(&format) {
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let new = handler.new;
|
let new = handler.new;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
pub mod ascii_reduce;
|
pub mod ascii_reduce;
|
||||||
|
pub mod ffprobe;
|
||||||
pub mod format_detection;
|
pub mod format_detection;
|
||||||
pub mod replaygain;
|
pub mod replaygain;
|
||||||
pub mod transcoder;
|
pub mod transcoder;
|
||||||
pub mod ffprobe;
|
|
||||||
|
|
||||||
pub mod formats;
|
pub mod formats;
|
||||||
mod music_scanner;
|
mod music_scanner;
|
||||||
|
|
||||||
pub use formats::is_supported_file;
|
pub use formats::is_supported_file;
|
||||||
pub use music_scanner::scan_for_music;
|
pub use music_scanner::scan_for_music;
|
||||||
|
|
|
@ -3,5 +3,5 @@ pub mod progress_monitor;
|
||||||
#[allow(clippy::all)]
|
#[allow(clippy::all)]
|
||||||
mod transcoder;
|
mod transcoder;
|
||||||
pub mod types;
|
pub mod types;
|
||||||
use self::progress_monitor::progress_monitor;
|
use self::progress_monitor::progress_monitor;
|
||||||
pub use self::transcoder::transcode;
|
pub use self::transcoder::transcode;
|
||||||
|
|
Loading…
Reference in a new issue