-
-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
A lot of projects that use Lofty are scanning directories and filtering files based on a set of extensions. What typically ends up happening is only a few popular extensions (mp3, flac, wav) will make it in the list, and not all of the formats that Lofty supports. Not to mention it's just a bunch of duplicated work.
FileType::from_ext
has a pretty good list of extensions:
lofty-rs/lofty/src/file/file_type.rs
Lines 130 to 145 in aa1ec31
match ext.as_str() { | |
"aac" => Some(Self::Aac), | |
"ape" => Some(Self::Ape), | |
"aiff" | "aif" | "afc" | "aifc" => Some(Self::Aiff), | |
"mp3" | "mp2" | "mp1" => Some(Self::Mpeg), | |
"wav" | "wave" => Some(Self::Wav), | |
"wv" => Some(Self::WavPack), | |
"opus" => Some(Self::Opus), | |
"flac" => Some(Self::Flac), | |
"ogg" => Some(Self::Vorbis), | |
"mp4" | "m4a" | "m4b" | "m4p" | "m4r" | "m4v" | "3gp" => Some(Self::Mp4), | |
"mpc" | "mp+" | "mpp" => Some(Self::Mpc), | |
"spx" => Some(Self::Speex), | |
_ => None, | |
} | |
} |
It too isn't perfect, of course. But if projects start using a list of extensions we provide, then they get any improvements to it for free.
API design
/// ...
/// NOTE: This is not an exhaustive list, blah blah blah
pub const EXTENSIONS: &[&str] = &["mp3", "flac", ...];
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request