diff --git a/CHANGELOG.md b/CHANGELOG.md index 605ae50..14740cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Added +- AIFF (Audio Interchange File Format, a PCM audio format like WAV) detection to [`infer`] ### Other - Refactoring - split fif into main.rs and lib.rs, moved file-related functionality (directory scanning, etc.) into files module, removed string module, etc. diff --git a/src/mime_db.rs b/src/mime_db.rs index ce9e8d9..01c4c8e 100644 --- a/src/mime_db.rs +++ b/src/mime_db.rs @@ -43,9 +43,23 @@ cfg_if! { buf.len() >= 34 && buf.starts_with(b"RPA-") && buf[7] == b' ' && buf[24] ==b' ' }); + info.add("audio/x-aiff", "aiff", |buf| { + // as added by https://github.com/bojand/infer/pull/48/files + // this should be removed when (if) that PR is accepted + buf.len() > 11 + && buf[0] == 0x46 + && buf[1] == 0x4F + && buf[2] == 0x52 + && buf[3] == 0x4D + && buf[8] == 0x41 + && buf[9] == 0x49 + && buf[10] == 0x46 + && buf[11] == 0x46 + }); + info.add("image/svg+xml", "svg", |buf| { - // before doing the moderately expensive SVG check, we should make sure that the input is actually SGML-ish - // by "SGML-ish", i mean starts with anywhere from zero to ∞-1 whitespace characters, and then a less than sign, + // before doing the moderately expensive SVG check, we should make sure that the input is actually SGML-ish, + // by which i mean, starts with anywhere from zero to ∞-1 whitespace characters, and then a less than sign, // and then there's some other stuff we don't care about right now // so, here comes our fancy pants """""SGML-ish validator""""" @@ -72,9 +86,6 @@ cfg_if! { .any(|buf| identifiers.iter().any(|id| buf.starts_with(id))) }); - // unmut - let info = info; - Self { db: info } } diff --git a/src/parameters.rs b/src/parameters.rs index 918ca9b..c20d36e 100644 --- a/src/parameters.rs +++ b/src/parameters.rs @@ -30,8 +30,6 @@ pub enum OutputFormat { Json, } -// TODO: convert this to macro style?: https://docs.rs/clap/3.0.0-beta.2/clap/index.html#using-macros - #[derive(Clap, Debug)] #[allow(clippy::struct_excessive_bools)] #[clap(