Remove duration feature, out of the scope of this crate

Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
Serial 2021-06-27 14:42:50 -04:00
parent e0a3e2b2ee
commit d5be11a40e
10 changed files with 29 additions and 58 deletions

17
Cargo.lock generated
View file

@ -324,7 +324,6 @@ dependencies = [
"id3",
"lofty_attr",
"metaflac",
"mp3-duration",
"mp4ameta",
"ogg_pager",
"riff",
@ -333,9 +332,8 @@ dependencies = [
[[package]]
name = "lofty_attr"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52bab5d43183b8022bc4f29af84eb32d2f812f789860be83cf16612b066815e"
version = "0.1.2"
source = "git+https://github.com/Serial-ATA/lofty-rs#e0a3e2b2ee6db1c42fd67807eed36c8e0b243c2d"
dependencies = [
"quote",
"syn",
@ -386,15 +384,6 @@ dependencies = [
"autocfg",
]
[[package]]
name = "mp3-duration"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "348bdc7300502f0801e5b57c448815713cd843b744ef9bda252a2698fdf90a0f"
dependencies = [
"thiserror",
]
[[package]]
name = "mp4ameta"
version = "0.10.2"
@ -433,7 +422,7 @@ dependencies = [
[[package]]
name = "ogg_pager"
version = "0.1.3"
source = "git+https://github.com/Serial-ATA/lofty-rs#54810611499625a3c4b99220f50fe5b22f73ea50"
source = "git+https://github.com/Serial-ATA/lofty-rs#e0a3e2b2ee6db1c42fd67807eed36c8e0b243c2d"
dependencies = [
"byteorder",
]

View file

@ -17,8 +17,6 @@ riff = {version = "1.0.1", optional = true}
# Id3
id3 = {version = "0.6.4", optional = true} # De/Encoding
filepath = { version = "0.1.1", optional = true } # wav/aiff only supports paths for some reason
# Mp3
mp3-duration = {version = "0.1.10", optional = true} # Duration
# Ogg
ogg_pager = { version = "0.1.3", optional = true, git = "https://github.com/Serial-ATA/lofty-rs" }
# Mp4
@ -31,11 +29,10 @@ thiserror = "1.0.25"
base64 = "0.13.0"
byteorder = "1.4.3"
lofty_attr = "0.1.0"
lofty_attr = { version = "0.1.2", git = "https://github.com/Serial-ATA/lofty-rs" }
[features]
default = ["full"]
full = ["all_tags", "duration"]
default = ["all_tags"]
format-mp4 = ["mp4ameta"]
format-flac = ["metaflac"]
format-opus = ["ogg_pager"]
@ -45,7 +42,6 @@ format-id3 = ["id3", "filepath"]
format-riff = ["riff"]
format-ogg = ["format-flac", "format-opus", "format-vorbis"]
all_tags = ["format-ogg", "format-mp4", "format-id3", "format-riff", "format-ape"]
duration = ["mp3-duration"]
[dev-dependencies]
criterion = { version = "0.3", features = ["html_reports"] }

View file

@ -4,22 +4,22 @@
[![Version](https://img.shields.io/crates/v/lofty?style=for-the-badge&logo=rust)](https://crates.io/crates/lofty)
[![Documentation](https://img.shields.io/badge/docs.rs-lofty-informational?style=for-the-badge&logo=read-the-docs)](https://docs.rs/lofty/)
This is a fork of [Audiotags](https://github.com/TianyiShi2001/audiotags), adding support for more file types and (optionally) duration.
This is a fork of [Audiotags](https://github.com/TianyiShi2001/audiotags), adding support for more file types.
Parse, convert, and write metadata to various audio formats.
## Supported Formats
| File Format | Extensions | Read | Write | Duration | Metadata Format(s) |
|-------------|-------------------------------------------|------|-------|----------|----------------------|
| Ape | `ape` |**X** |**X** | | `APEv2` |
| AIFF | `aiff`, `aif` |**X** |**X** | | `ID3v2` |
| FLAC | `flac` |**X** |**X** | | `Vorbis Comments` |
| MP3 | `mp3` |**X** |**X** |**X** | `ID3v2` |
| MP4 | `mp4`, `m4a`, `m4b`, `m4p`, `m4v`, `isom` |**X** |**X** | | `Vorbis Comments` |
| Opus | `opus` |**X** |**X** | | `Vorbis Comments` |
| Ogg | `ogg`, `oga` |**X** |**X** | | `Vorbis Comments` |
| WAV | `wav`, `wave` |**X** |**X** | | `RIFF INFO`, `ID3v2` |
| File Format | Extensions | Read | Write | Metadata Format(s) |
|-------------|-------------------------------------------|------|-------|---------------------|
| Ape | `ape` |**X** |**X** |`APEv2` |
| AIFF | `aiff`, `aif` |**X** |**X** |`ID3v2` |
| FLAC | `flac` |**X** |**X** |`Vorbis Comments` |
| MP3 | `mp3` |**X** |**X** |`ID3v2` |
| MP4 | `mp4`, `m4a`, `m4b`, `m4p`, `m4v`, `isom` |**X** |**X** |`Vorbis Comments` |
| Opus | `opus` |**X** |**X** |`Vorbis Comments` |
| Ogg | `ogg`, `oga` |**X** |**X** |`Vorbis Comments` |
| WAV | `wav`, `wave` |**X** |**X** |`RIFF INFO`, `ID3v2` |
## Documentation

View file

@ -25,8 +25,6 @@ impl ApeTag {
{
Ok(Self {
inner: ape::read_from(reader)?,
#[cfg(feature = "duration")]
duration: None, // TODO
})
}
}

View file

@ -28,18 +28,12 @@ impl Id3v2Tag {
match format {
Id3Format::Default => Ok(Self {
inner: Id3v2InnerTag::read_from(reader)?,
#[cfg(feature = "duration")]
duration: None, // TODO
}),
Id3Format::Riff => Ok(Self {
inner: Id3v2InnerTag::read_from_wav_reader(reader)?,
#[cfg(feature = "duration")]
duration: None,
}),
Id3Format::Form => Ok(Self {
inner: Id3v2InnerTag::read_from_aiff_reader(reader)?,
#[cfg(feature = "duration")]
duration: None,
}),
}
}

View file

@ -24,8 +24,6 @@ impl Mp4Tag {
{
Ok(Self {
inner: Mp4InnerTag::read_from(reader)?,
#[cfg(feature = "duration")]
duration: None,
})
}
}

View file

@ -37,8 +37,6 @@ impl RiffTag {
inner: RiffInnerTag {
data: riff::read_from(reader)?,
},
#[cfg(feature = "duration")]
duration: None,
})
}
}

View file

@ -178,8 +178,6 @@ impl VorbisTag {
{
Ok(Self {
inner: VorbisInnerTag::read_from(reader, format)?,
#[cfg(feature = "duration")]
duration: None,
})
}
}

View file

@ -2,22 +2,22 @@
//! [![Downloads](https://img.shields.io/crates/d/lofty?style=for-the-badge&logo=rust)](https://crates.io/crates/lofty)
//! [![Version](https://img.shields.io/crates/v/lofty?style=for-the-badge&logo=rust)](https://crates.io/crates/lofty)
//!
//! This is a fork of [Audiotags](https://github.com/TianyiShi2001/audiotags), adding support for more file types and (optionally) duration.
//! This is a fork of [Audiotags](https://github.com/TianyiShi2001/audiotags), adding support for more file types.
//!
//! Parse, convert, and write metadata to audio formats.
//!
//! # Supported Formats
//!
//! | File Format | Extensions | Read | Write | Duration | Metadata Format(s) |
//! |-------------|-------------------------------------------|------|-------|----------|----------------------|
//! | Ape | `ape` |**X** |**X** | | `APEv2` |
//! | AIFF | `aiff`, `aif` |**X** |**X** | | `ID3v2` |
//! | FLAC | `flac` |**X** |**X** | | `Vorbis Comments` |
//! | MP3 | `mp3` |**X** |**X** |**X** | `ID3v2` |
//! | MP4 | `mp4`, `m4a`, `m4b`, `m4p`, `m4v`, `isom` |**X** |**X** | | `Vorbis Comments` |
//! | Opus | `opus` |**X** |**X** | | `Vorbis Comments` |
//! | Ogg | `ogg`, `oga` |**X** |**X** | | `Vorbis Comments` |
//! | WAV | `wav`, `wave` |**X** |**X** | | `RIFF INFO`, `ID3v2` |
//!| File Format | Extensions | Read | Write | Metadata Format(s) |
//!|-------------|-------------------------------------------|------|-------|---------------------|
//!| Ape | `ape` |**X** |**X** |`APEv2` |
//!| AIFF | `aiff`, `aif` |**X** |**X** |`ID3v2` |
//!| FLAC | `flac` |**X** |**X** |`Vorbis Comments` |
//!| MP3 | `mp3` |**X** |**X** |`ID3v2` |
//!| MP4 | `mp4`, `m4a`, `m4b`, `m4p`, `m4v`, `isom` |**X** |**X** |`Vorbis Comments` |
//!| Opus | `opus` |**X** |**X** |`Vorbis Comments` |
//!| Ogg | `ogg`, `oga` |**X** |**X** |`Vorbis Comments` |
//!| WAV | `wav`, `wave` |**X** |**X** |`RIFF INFO`, `ID3v2` |
//!
//! # Examples
//!

View file

@ -27,7 +27,7 @@ const VORBIS: [u8; 6] = [118, 111, 114, 98, 105, 115];
#[cfg(feature = "format-riff")]
const RIFF: [u8; 4] = [82, 73, 70, 70];
/// A builder for `Box<dyn AudioTag>`. If you do not want a trait object, you can use individual types.
/// A builder for `Box<dyn AudioTag>`
#[derive(Default)]
pub struct Tag(Option<TagType>);
@ -37,7 +37,7 @@ impl Tag {
Self::default()
}
/// This function can be used to specify a `TagType`, so there's no guessing
/// This function can be used to specify a `TagType` to skip the guessing entirely
#[allow(clippy::unused_self)]
pub fn with_tag_type(self, tag_type: TagType) -> Self {
Self(Some(tag_type))