mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-10 06:34:18 +00:00
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:
parent
e0a3e2b2ee
commit
d5be11a40e
10 changed files with 29 additions and 58 deletions
17
Cargo.lock
generated
17
Cargo.lock
generated
|
@ -324,7 +324,6 @@ dependencies = [
|
||||||
"id3",
|
"id3",
|
||||||
"lofty_attr",
|
"lofty_attr",
|
||||||
"metaflac",
|
"metaflac",
|
||||||
"mp3-duration",
|
|
||||||
"mp4ameta",
|
"mp4ameta",
|
||||||
"ogg_pager",
|
"ogg_pager",
|
||||||
"riff",
|
"riff",
|
||||||
|
@ -333,9 +332,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lofty_attr"
|
name = "lofty_attr"
|
||||||
version = "0.1.0"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/Serial-ATA/lofty-rs#e0a3e2b2ee6db1c42fd67807eed36c8e0b243c2d"
|
||||||
checksum = "d52bab5d43183b8022bc4f29af84eb32d2f812f789860be83cf16612b066815e"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
|
@ -386,15 +384,6 @@ dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mp3-duration"
|
|
||||||
version = "0.1.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "348bdc7300502f0801e5b57c448815713cd843b744ef9bda252a2698fdf90a0f"
|
|
||||||
dependencies = [
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mp4ameta"
|
name = "mp4ameta"
|
||||||
version = "0.10.2"
|
version = "0.10.2"
|
||||||
|
@ -433,7 +422,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ogg_pager"
|
name = "ogg_pager"
|
||||||
version = "0.1.3"
|
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 = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
]
|
]
|
||||||
|
|
|
@ -17,8 +17,6 @@ riff = {version = "1.0.1", optional = true}
|
||||||
# Id3
|
# Id3
|
||||||
id3 = {version = "0.6.4", optional = true} # De/Encoding
|
id3 = {version = "0.6.4", optional = true} # De/Encoding
|
||||||
filepath = { version = "0.1.1", optional = true } # wav/aiff only supports paths for some reason
|
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
|
||||||
ogg_pager = { version = "0.1.3", optional = true, git = "https://github.com/Serial-ATA/lofty-rs" }
|
ogg_pager = { version = "0.1.3", optional = true, git = "https://github.com/Serial-ATA/lofty-rs" }
|
||||||
# Mp4
|
# Mp4
|
||||||
|
@ -31,11 +29,10 @@ thiserror = "1.0.25"
|
||||||
base64 = "0.13.0"
|
base64 = "0.13.0"
|
||||||
byteorder = "1.4.3"
|
byteorder = "1.4.3"
|
||||||
|
|
||||||
lofty_attr = "0.1.0"
|
lofty_attr = { version = "0.1.2", git = "https://github.com/Serial-ATA/lofty-rs" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["full"]
|
default = ["all_tags"]
|
||||||
full = ["all_tags", "duration"]
|
|
||||||
format-mp4 = ["mp4ameta"]
|
format-mp4 = ["mp4ameta"]
|
||||||
format-flac = ["metaflac"]
|
format-flac = ["metaflac"]
|
||||||
format-opus = ["ogg_pager"]
|
format-opus = ["ogg_pager"]
|
||||||
|
@ -45,7 +42,6 @@ format-id3 = ["id3", "filepath"]
|
||||||
format-riff = ["riff"]
|
format-riff = ["riff"]
|
||||||
format-ogg = ["format-flac", "format-opus", "format-vorbis"]
|
format-ogg = ["format-flac", "format-opus", "format-vorbis"]
|
||||||
all_tags = ["format-ogg", "format-mp4", "format-id3", "format-riff", "format-ape"]
|
all_tags = ["format-ogg", "format-mp4", "format-id3", "format-riff", "format-ape"]
|
||||||
duration = ["mp3-duration"]
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = { version = "0.3", features = ["html_reports"] }
|
criterion = { version = "0.3", features = ["html_reports"] }
|
||||||
|
|
22
README.md
22
README.md
|
@ -4,22 +4,22 @@
|
||||||
[![Version](https://img.shields.io/crates/v/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)
|
||||||
[![Documentation](https://img.shields.io/badge/docs.rs-lofty-informational?style=for-the-badge&logo=read-the-docs)](https://docs.rs/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.
|
Parse, convert, and write metadata to various audio formats.
|
||||||
|
|
||||||
## Supported Formats
|
## Supported Formats
|
||||||
|
|
||||||
| File Format | Extensions | Read | Write | Duration | Metadata Format(s) |
|
| File Format | Extensions | Read | Write | Metadata Format(s) |
|
||||||
|-------------|-------------------------------------------|------|-------|----------|----------------------|
|
|-------------|-------------------------------------------|------|-------|---------------------|
|
||||||
| Ape | `ape` |**X** |**X** | | `APEv2` |
|
| Ape | `ape` |**X** |**X** |`APEv2` |
|
||||||
| AIFF | `aiff`, `aif` |**X** |**X** | | `ID3v2` |
|
| AIFF | `aiff`, `aif` |**X** |**X** |`ID3v2` |
|
||||||
| FLAC | `flac` |**X** |**X** | | `Vorbis Comments` |
|
| FLAC | `flac` |**X** |**X** |`Vorbis Comments` |
|
||||||
| MP3 | `mp3` |**X** |**X** |**X** | `ID3v2` |
|
| MP3 | `mp3` |**X** |**X** |`ID3v2` |
|
||||||
| MP4 | `mp4`, `m4a`, `m4b`, `m4p`, `m4v`, `isom` |**X** |**X** | | `Vorbis Comments` |
|
| MP4 | `mp4`, `m4a`, `m4b`, `m4p`, `m4v`, `isom` |**X** |**X** |`Vorbis Comments` |
|
||||||
| Opus | `opus` |**X** |**X** | | `Vorbis Comments` |
|
| Opus | `opus` |**X** |**X** |`Vorbis Comments` |
|
||||||
| Ogg | `ogg`, `oga` |**X** |**X** | | `Vorbis Comments` |
|
| Ogg | `ogg`, `oga` |**X** |**X** |`Vorbis Comments` |
|
||||||
| WAV | `wav`, `wave` |**X** |**X** | | `RIFF INFO`, `ID3v2` |
|
| WAV | `wav`, `wave` |**X** |**X** |`RIFF INFO`, `ID3v2` |
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ impl ApeTag {
|
||||||
{
|
{
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
inner: ape::read_from(reader)?,
|
inner: ape::read_from(reader)?,
|
||||||
#[cfg(feature = "duration")]
|
|
||||||
duration: None, // TODO
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,18 +28,12 @@ impl Id3v2Tag {
|
||||||
match format {
|
match format {
|
||||||
Id3Format::Default => Ok(Self {
|
Id3Format::Default => Ok(Self {
|
||||||
inner: Id3v2InnerTag::read_from(reader)?,
|
inner: Id3v2InnerTag::read_from(reader)?,
|
||||||
#[cfg(feature = "duration")]
|
|
||||||
duration: None, // TODO
|
|
||||||
}),
|
}),
|
||||||
Id3Format::Riff => Ok(Self {
|
Id3Format::Riff => Ok(Self {
|
||||||
inner: Id3v2InnerTag::read_from_wav_reader(reader)?,
|
inner: Id3v2InnerTag::read_from_wav_reader(reader)?,
|
||||||
#[cfg(feature = "duration")]
|
|
||||||
duration: None,
|
|
||||||
}),
|
}),
|
||||||
Id3Format::Form => Ok(Self {
|
Id3Format::Form => Ok(Self {
|
||||||
inner: Id3v2InnerTag::read_from_aiff_reader(reader)?,
|
inner: Id3v2InnerTag::read_from_aiff_reader(reader)?,
|
||||||
#[cfg(feature = "duration")]
|
|
||||||
duration: None,
|
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,6 @@ impl Mp4Tag {
|
||||||
{
|
{
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
inner: Mp4InnerTag::read_from(reader)?,
|
inner: Mp4InnerTag::read_from(reader)?,
|
||||||
#[cfg(feature = "duration")]
|
|
||||||
duration: None,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,6 @@ impl RiffTag {
|
||||||
inner: RiffInnerTag {
|
inner: RiffInnerTag {
|
||||||
data: riff::read_from(reader)?,
|
data: riff::read_from(reader)?,
|
||||||
},
|
},
|
||||||
#[cfg(feature = "duration")]
|
|
||||||
duration: None,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,8 +178,6 @@ impl VorbisTag {
|
||||||
{
|
{
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
inner: VorbisInnerTag::read_from(reader, format)?,
|
inner: VorbisInnerTag::read_from(reader, format)?,
|
||||||
#[cfg(feature = "duration")]
|
|
||||||
duration: None,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
22
src/lib.rs
22
src/lib.rs
|
@ -2,22 +2,22 @@
|
||||||
//! [![Downloads](https://img.shields.io/crates/d/lofty?style=for-the-badge&logo=rust)](https://crates.io/crates/lofty)
|
//! [![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)
|
//! [![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.
|
//! Parse, convert, and write metadata to audio formats.
|
||||||
//!
|
//!
|
||||||
//! # Supported Formats
|
//! # Supported Formats
|
||||||
//!
|
//!
|
||||||
//! | File Format | Extensions | Read | Write | Duration | Metadata Format(s) |
|
//!| File Format | Extensions | Read | Write | Metadata Format(s) |
|
||||||
//! |-------------|-------------------------------------------|------|-------|----------|----------------------|
|
//!|-------------|-------------------------------------------|------|-------|---------------------|
|
||||||
//! | Ape | `ape` |**X** |**X** | | `APEv2` |
|
//!| Ape | `ape` |**X** |**X** |`APEv2` |
|
||||||
//! | AIFF | `aiff`, `aif` |**X** |**X** | | `ID3v2` |
|
//!| AIFF | `aiff`, `aif` |**X** |**X** |`ID3v2` |
|
||||||
//! | FLAC | `flac` |**X** |**X** | | `Vorbis Comments` |
|
//!| FLAC | `flac` |**X** |**X** |`Vorbis Comments` |
|
||||||
//! | MP3 | `mp3` |**X** |**X** |**X** | `ID3v2` |
|
//!| MP3 | `mp3` |**X** |**X** |`ID3v2` |
|
||||||
//! | MP4 | `mp4`, `m4a`, `m4b`, `m4p`, `m4v`, `isom` |**X** |**X** | | `Vorbis Comments` |
|
//!| MP4 | `mp4`, `m4a`, `m4b`, `m4p`, `m4v`, `isom` |**X** |**X** |`Vorbis Comments` |
|
||||||
//! | Opus | `opus` |**X** |**X** | | `Vorbis Comments` |
|
//!| Opus | `opus` |**X** |**X** |`Vorbis Comments` |
|
||||||
//! | Ogg | `ogg`, `oga` |**X** |**X** | | `Vorbis Comments` |
|
//!| Ogg | `ogg`, `oga` |**X** |**X** |`Vorbis Comments` |
|
||||||
//! | WAV | `wav`, `wave` |**X** |**X** | | `RIFF INFO`, `ID3v2` |
|
//!| WAV | `wav`, `wave` |**X** |**X** |`RIFF INFO`, `ID3v2` |
|
||||||
//!
|
//!
|
||||||
//! # Examples
|
//! # Examples
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -27,7 +27,7 @@ const VORBIS: [u8; 6] = [118, 111, 114, 98, 105, 115];
|
||||||
#[cfg(feature = "format-riff")]
|
#[cfg(feature = "format-riff")]
|
||||||
const RIFF: [u8; 4] = [82, 73, 70, 70];
|
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)]
|
#[derive(Default)]
|
||||||
pub struct Tag(Option<TagType>);
|
pub struct Tag(Option<TagType>);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ impl Tag {
|
||||||
Self::default()
|
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)]
|
#[allow(clippy::unused_self)]
|
||||||
pub fn with_tag_type(self, tag_type: TagType) -> Self {
|
pub fn with_tag_type(self, tag_type: TagType) -> Self {
|
||||||
Self(Some(tag_type))
|
Self(Some(tag_type))
|
||||||
|
|
Loading…
Reference in a new issue