Continue to fix feature issues

Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
Serial 2021-06-29 23:38:20 -04:00
parent cc8a0a21d5
commit 3eac3b5bc2
5 changed files with 35 additions and 7 deletions

View file

@ -31,26 +31,32 @@ pub enum LoftyError {
#[error("Picture contains invalid data")]
NotAPicture,
#[cfg(feature = "format-ape")]
// Tag related errors
/// Any error from [`ape`]
#[error(transparent)]
ApeTag(#[from] ape::Error),
#[cfg(feature = "format-flac")]
/// Any error from [`metaflac`]
#[error(transparent)]
FlacTag(#[from] metaflac::Error),
#[cfg(feature = "format-id3")]
/// Any error from [`id3`]
#[error(transparent)]
Id3Tag(#[from] id3::Error),
/// Any error from [`mp3_duration`]
#[cfg(feature = "duration")]
#[error(transparent)]
Mp3Duration(#[from] mp3_duration::MP3DurationError),
#[cfg(feature = "format-mp4")]
/// Any error from [`mp4ameta`]
#[error(transparent)]
Mp4Tag(#[from] mp4ameta::Error),
/// Errors that arrist while parsing OGG pages
#[cfg(any(
feature = "format-opus",
feature = "format-vorbis",
feature = "format-flac"
))]
#[error(transparent)]
OggPage(#[from] ogg_pager::PageError),
#[cfg(feature = "format-riff")]
/// Errors that arise while reading/writing to wav files
#[error("Invalid Riff file: {0}")]
Riff(&'static str),

View file

@ -107,7 +107,15 @@ pub use crate::types::{
};
mod tag;
pub use crate::tag::{Id3Format, OggFormat, Tag, TagType};
#[cfg(feature = "format-id3")]
pub use crate::tag::Id3Format;
#[cfg(any(
feature = "format-opus",
feature = "format-vorbis",
feature = "format-flac"
))]
pub use crate::tag::OggFormat;
pub use crate::tag::{Tag, TagType};
mod error;
pub use crate::error::{LoftyError, Result};

View file

@ -304,6 +304,12 @@ impl Picture {
}
}
#[cfg(any(
feature = "format-id3",
feature = "format-opus",
feature = "format-vorbis",
feature = "format-flac"
))]
/// Convert the [`Picture`] back to an APIC byte vec:
///
/// * Id3v2 APIC
@ -336,6 +342,12 @@ impl Picture {
data
}
#[cfg(any(
feature = "format-id3",
feature = "format-opus",
feature = "format-vorbis",
feature = "format-flac"
))]
/// Get a [`Picture`] from APIC bytes:
///
/// * Id3v2 APIC
@ -397,6 +409,7 @@ impl Picture {
Err(LoftyError::NotAPicture)
}
#[cfg(feature = "format-ape")]
/// Convert the [`Picture`] back to an APEv2 byte vec:
///
/// * APEv2 Cover Art
@ -418,6 +431,7 @@ impl Picture {
data
}
#[cfg(feature = "format-ape")]
/// Get a [`Picture`] from APEv2 bytes:
///
/// * APEv2 Cover Art

View file

@ -1,4 +1,4 @@
use lofty::{OggFormat, Tag, TagType, Id3Format};
use lofty::{Id3Format, OggFormat, Tag, TagType};
macro_rules! convert_tag {
($tag: ident) => {

View file

@ -1,4 +1,4 @@
use lofty::{Id3Format, Tag, TagType, ToAnyTag, OggTag};
use lofty::{Id3Format, OggTag, Tag, TagType, ToAnyTag};
use std::convert::TryInto;
#[test]