mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-10 06:34:18 +00:00
tag: Switch TagType
variants to UpperCamelCase
This commit is contained in:
parent
8920a39f93
commit
ce8c26f2b8
37 changed files with 196 additions and 197 deletions
|
@ -24,12 +24,12 @@ struct MyFile {
|
|||
|
||||
|
||||
// Specify a tag type
|
||||
#[lofty(tag_type = "ID3v2")]
|
||||
#[lofty(tag_type = "Id3v2")]
|
||||
// Let's say our file *always* has an ID3v2Tag present.
|
||||
pub id3v2_tag: ID3v2Tag,
|
||||
|
||||
// Our APE tag is optional in this format, so we wrap it in an `Option`
|
||||
#[lofty(tag_type = "APE")]
|
||||
#[lofty(tag_type = "Ape")]
|
||||
pub ape_tag: Option<ApeTag>,
|
||||
|
||||
// The properties field *must* be present and named as such.
|
||||
|
@ -62,13 +62,13 @@ impl FileResolver for MyFile {
|
|||
// The primary `TagType` of the file, or the one most
|
||||
// likely to be used with it
|
||||
fn primary_tag_type() -> TagType {
|
||||
TagType::ID3v2
|
||||
TagType::Id3v2
|
||||
}
|
||||
|
||||
// All of the `TagType`s this file supports, including the
|
||||
// primary one.
|
||||
fn supported_tag_types() -> &'static [TagType] {
|
||||
&[TagType::ID3v2, TagType::APE]
|
||||
&[TagType::Id3v2, TagType::Ape]
|
||||
}
|
||||
|
||||
// This is used to guess the `FileType` when reading the file contents.
|
||||
|
|
|
@ -42,7 +42,7 @@ pub(crate) fn init_write_lookup(
|
|||
};
|
||||
}
|
||||
|
||||
insert!(map, APE, {
|
||||
insert!(map, Ape, {
|
||||
lofty::ape::tag::ApeTagRef {
|
||||
read_only: false,
|
||||
items: lofty::ape::tag::tagitems_into_ape(tag.items()),
|
||||
|
@ -50,16 +50,16 @@ pub(crate) fn init_write_lookup(
|
|||
.write_to(data)
|
||||
});
|
||||
|
||||
insert!(map, ID3v1, {
|
||||
insert!(map, Id3v1, {
|
||||
Into::<lofty::id3::v1::tag::Id3v1TagRef<'_>>::into(tag).write_to(data)
|
||||
});
|
||||
|
||||
if id3v2_strippable {
|
||||
insert!(map, ID3v2, {
|
||||
insert!(map, Id3v2, {
|
||||
lofty::id3::v2::tag::Id3v2TagRef::empty().write_to(data)
|
||||
});
|
||||
} else {
|
||||
insert!(map, ID3v2, {
|
||||
insert!(map, Id3v2, {
|
||||
lofty::id3::v2::tag::Id3v2TagRef {
|
||||
flags: lofty::id3::v2::ID3v2TagFlags::default(),
|
||||
frames: lofty::id3::v2::tag::tag_frames(tag),
|
||||
|
@ -68,14 +68,14 @@ pub(crate) fn init_write_lookup(
|
|||
});
|
||||
}
|
||||
|
||||
insert!(map, RIFFInfo, {
|
||||
insert!(map, RiffInfo, {
|
||||
lofty::iff::wav::tag::RIFFInfoListRef::new(lofty::iff::wav::tag::tagitems_into_riff(
|
||||
tag.items(),
|
||||
))
|
||||
.write_to(data)
|
||||
});
|
||||
|
||||
insert!(map, AIFFText, {
|
||||
insert!(map, AiffText, {
|
||||
lofty::iff::aiff::tag::AiffTextChunksRef {
|
||||
name: tag.get_string(&lofty::tag::item::ItemKey::TrackTitle),
|
||||
author: tag.get_string(&lofty::tag::item::ItemKey::TrackArtist),
|
||||
|
|
|
@ -20,9 +20,9 @@ pub use properties::AACProperties;
|
|||
#[lofty(read_fn = "read::read_from")]
|
||||
#[lofty(internal_write_module_do_not_use_anywhere_else)]
|
||||
pub struct AacFile {
|
||||
#[lofty(tag_type = "ID3v2")]
|
||||
#[lofty(tag_type = "Id3v2")]
|
||||
pub(crate) id3v2_tag: Option<ID3v2Tag>,
|
||||
#[lofty(tag_type = "ID3v1")]
|
||||
#[lofty(tag_type = "Id3v1")]
|
||||
pub(crate) id3v1_tag: Option<ID3v1Tag>,
|
||||
pub(crate) properties: AACProperties,
|
||||
}
|
||||
|
|
|
@ -29,13 +29,13 @@ pub use tag::ApeTag;
|
|||
#[lofty(internal_write_module_do_not_use_anywhere_else)]
|
||||
pub struct ApeFile {
|
||||
/// An ID3v1 tag
|
||||
#[lofty(tag_type = "ID3v1")]
|
||||
#[lofty(tag_type = "Id3v1")]
|
||||
pub(crate) id3v1_tag: Option<ID3v1Tag>,
|
||||
/// An ID3v2 tag (Not officially supported)
|
||||
#[lofty(tag_type = "ID3v2")]
|
||||
#[lofty(tag_type = "Id3v2")]
|
||||
pub(crate) id3v2_tag: Option<ID3v2Tag>,
|
||||
/// An APEv1/v2 tag
|
||||
#[lofty(tag_type = "APE")]
|
||||
#[lofty(tag_type = "Ape")]
|
||||
pub(crate) ape_tag: Option<ApeTag>,
|
||||
/// The file's audio properties
|
||||
pub(crate) properties: ApeProperties,
|
||||
|
|
|
@ -73,7 +73,7 @@ impl TryFrom<TagItem> for ApeItem {
|
|||
Self::new(
|
||||
value
|
||||
.item_key
|
||||
.map_key(TagType::APE, false)
|
||||
.map_key(TagType::Ape, false)
|
||||
.ok_or_else(|| decode_err!(Ape, "Attempted to convert an unsupported item key"))?
|
||||
.to_string(),
|
||||
value.item_value,
|
||||
|
|
|
@ -317,11 +317,11 @@ impl TagExt for ApeTag {
|
|||
}
|
||||
|
||||
fn remove_from_path<P: AsRef<Path>>(&self, path: P) -> std::result::Result<(), Self::Err> {
|
||||
TagType::APE.remove_from_path(path)
|
||||
TagType::Ape.remove_from_path(path)
|
||||
}
|
||||
|
||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||
TagType::APE.remove_from(file)
|
||||
TagType::Ape.remove_from(file)
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
|
@ -369,10 +369,10 @@ impl SplitTag for ApeTag {
|
|||
Some(())
|
||||
}
|
||||
|
||||
let mut tag = Tag::new(TagType::APE);
|
||||
let mut tag = Tag::new(TagType::Ape);
|
||||
|
||||
for item in std::mem::take(&mut self.items) {
|
||||
let item_key = ItemKey::from_key(TagType::APE, item.key());
|
||||
let item_key = ItemKey::from_key(TagType::Ape, item.key());
|
||||
|
||||
// The text pairs need some special treatment
|
||||
match (item_key, item.value()) {
|
||||
|
@ -475,7 +475,7 @@ pub(crate) fn tagitems_into_ape<'a>(
|
|||
items: impl IntoIterator<Item = &'a TagItem>,
|
||||
) -> impl Iterator<Item = ApeItemRef<'a>> {
|
||||
items.into_iter().filter_map(|i| {
|
||||
i.key().map_key(TagType::APE, true).map(|key| ApeItemRef {
|
||||
i.key().map_key(TagType::Ape, true).map(|key| ApeItemRef {
|
||||
read_only: false,
|
||||
key,
|
||||
value: (&i.item_value).into(),
|
||||
|
@ -606,7 +606,7 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
let tag = crate::tag::utils::test_utils::create_tag(TagType::APE);
|
||||
let tag = crate::tag::utils::test_utils::create_tag(TagType::Ape);
|
||||
|
||||
let ape_tag: ApeTag = tag.into();
|
||||
|
||||
|
|
66
src/file.rs
66
src/file.rs
|
@ -136,7 +136,7 @@ pub trait TaggedFileExt {
|
|||
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
|
||||
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
|
||||
///
|
||||
/// assert_eq!(tagged_file.primary_tag_type(), TagType::ID3v2);
|
||||
/// assert_eq!(tagged_file.primary_tag_type(), TagType::Id3v2);
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
fn primary_tag_type(&self) -> TagType {
|
||||
|
@ -154,7 +154,7 @@ pub trait TaggedFileExt {
|
|||
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
|
||||
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
|
||||
///
|
||||
/// assert!(tagged_file.supports_tag_type(TagType::ID3v2));
|
||||
/// assert!(tagged_file.supports_tag_type(TagType::Id3v2));
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
fn supports_tag_type(&self, tag_type: TagType) -> bool {
|
||||
|
@ -174,10 +174,10 @@ pub trait TaggedFileExt {
|
|||
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
|
||||
///
|
||||
/// // An ID3v2 tag
|
||||
/// let tag = tagged_file.tag(TagType::ID3v2);
|
||||
/// let tag = tagged_file.tag(TagType::Id3v2);
|
||||
///
|
||||
/// assert!(tag.is_some());
|
||||
/// assert_eq!(tag.unwrap().tag_type(), TagType::ID3v2);
|
||||
/// assert_eq!(tag.unwrap().tag_type(), TagType::Id3v2);
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
fn tag(&self, tag_type: TagType) -> Option<&Tag>;
|
||||
|
@ -195,10 +195,10 @@ pub trait TaggedFileExt {
|
|||
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
|
||||
///
|
||||
/// // An ID3v2 tag
|
||||
/// let tag = tagged_file.tag(TagType::ID3v2);
|
||||
/// let tag = tagged_file.tag(TagType::Id3v2);
|
||||
///
|
||||
/// assert!(tag.is_some());
|
||||
/// assert_eq!(tag.unwrap().tag_type(), TagType::ID3v2);
|
||||
/// assert_eq!(tag.unwrap().tag_type(), TagType::Id3v2);
|
||||
///
|
||||
/// // Alter the tag...
|
||||
/// # Ok(()) }
|
||||
|
@ -223,7 +223,7 @@ pub trait TaggedFileExt {
|
|||
/// let tag = tagged_file.primary_tag();
|
||||
///
|
||||
/// assert!(tag.is_some());
|
||||
/// assert_eq!(tag.unwrap().tag_type(), TagType::ID3v2);
|
||||
/// assert_eq!(tag.unwrap().tag_type(), TagType::Id3v2);
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
fn primary_tag(&self) -> Option<&Tag> {
|
||||
|
@ -248,7 +248,7 @@ pub trait TaggedFileExt {
|
|||
/// let tag = tagged_file.primary_tag_mut();
|
||||
///
|
||||
/// assert!(tag.is_some());
|
||||
/// assert_eq!(tag.unwrap().tag_type(), TagType::ID3v2);
|
||||
/// assert_eq!(tag.unwrap().tag_type(), TagType::Id3v2);
|
||||
///
|
||||
/// // Alter the tag...
|
||||
/// # Ok(()) }
|
||||
|
@ -321,15 +321,15 @@ pub trait TaggedFileExt {
|
|||
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
|
||||
/// // Read an MP3 file without an ID3v2 tag
|
||||
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
|
||||
/// # let _ = tagged_file.remove(TagType::ID3v2); // sneaky
|
||||
/// # let _ = tagged_file.remove(TagType::Id3v2); // sneaky
|
||||
///
|
||||
/// assert!(!tagged_file.contains_tag_type(TagType::ID3v2));
|
||||
/// assert!(!tagged_file.contains_tag_type(TagType::Id3v2));
|
||||
///
|
||||
/// // Insert the ID3v2 tag
|
||||
/// let new_id3v2_tag = Tag::new(TagType::ID3v2);
|
||||
/// let new_id3v2_tag = Tag::new(TagType::Id3v2);
|
||||
/// tagged_file.insert_tag(new_id3v2_tag);
|
||||
///
|
||||
/// assert!(tagged_file.contains_tag_type(TagType::ID3v2));
|
||||
/// assert!(tagged_file.contains_tag_type(TagType::Id3v2));
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
fn insert_tag(&mut self, tag: Tag) -> Option<Tag>;
|
||||
|
@ -346,12 +346,12 @@ pub trait TaggedFileExt {
|
|||
/// // Read an MP3 file containing an ID3v2 tag
|
||||
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
|
||||
///
|
||||
/// assert!(tagged_file.contains_tag_type(TagType::ID3v2));
|
||||
/// assert!(tagged_file.contains_tag_type(TagType::Id3v2));
|
||||
///
|
||||
/// // Take the ID3v2 tag
|
||||
/// let id3v2 = tagged_file.remove(TagType::ID3v2);
|
||||
/// let id3v2 = tagged_file.remove(TagType::Id3v2);
|
||||
///
|
||||
/// assert!(!tagged_file.contains_tag_type(TagType::ID3v2));
|
||||
/// assert!(!tagged_file.contains_tag_type(TagType::Id3v2));
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
fn remove(&mut self, tag_type: TagType) -> Option<Tag>;
|
||||
|
@ -416,12 +416,12 @@ impl TaggedFile {
|
|||
/// // Read an MP3 file containing an ID3v2 tag
|
||||
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
|
||||
///
|
||||
/// assert!(tagged_file.contains_tag_type(TagType::ID3v2));
|
||||
/// assert!(tagged_file.contains_tag_type(TagType::Id3v2));
|
||||
///
|
||||
/// // Remap our MP3 file to WavPack, which doesn't support ID3v2
|
||||
/// tagged_file.change_file_type(FileType::WavPack);
|
||||
///
|
||||
/// assert!(!tagged_file.contains_tag_type(TagType::ID3v2));
|
||||
/// assert!(!tagged_file.contains_tag_type(TagType::Id3v2));
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
pub fn change_file_type(&mut self, file_type: FileType) {
|
||||
|
@ -533,7 +533,7 @@ impl From<BoundTaggedFile> for TaggedFile {
|
|||
/// # let path = "tests/files/assets/minimal/full_test.mp3";
|
||||
///
|
||||
/// // We create an empty tag
|
||||
/// let tag = Tag::new(TagType::ID3v2);
|
||||
/// let tag = Tag::new(TagType::Id3v2);
|
||||
///
|
||||
/// let mut tagged_file = lofty::read_from_path(path)?;
|
||||
///
|
||||
|
@ -544,7 +544,7 @@ impl From<BoundTaggedFile> for TaggedFile {
|
|||
/// // "foo.mp3", it would not have an ID3v2 tag. Lofty does not write empty tags, but this
|
||||
/// // change will not be reflected in `TaggedFile`.
|
||||
/// tagged_file.save_to_path("foo.mp3")?;
|
||||
/// assert!(tagged_file.contains_tag_type(TagType::ID3v2));
|
||||
/// assert!(tagged_file.contains_tag_type(TagType::Id3v2));
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
///
|
||||
|
@ -557,7 +557,7 @@ impl From<BoundTaggedFile> for TaggedFile {
|
|||
/// # let path = "tests/files/assets/minimal/full_test.mp3";
|
||||
///
|
||||
/// // We create an empty tag
|
||||
/// let tag = Tag::new(TagType::ID3v2);
|
||||
/// let tag = Tag::new(TagType::Id3v2);
|
||||
///
|
||||
/// // We'll need to open our file for reading *and* writing
|
||||
/// let file = OpenOptions::new().read(true).write(true).open(path)?;
|
||||
|
@ -571,7 +571,7 @@ impl From<BoundTaggedFile> for TaggedFile {
|
|||
/// // Now when saving, we no longer have to specify a path, and the tags in the `BoundTaggedFile`
|
||||
/// // reflect those in the actual file on disk.
|
||||
/// bound_tagged_file.save()?;
|
||||
/// assert!(!bound_tagged_file.contains_tag_type(TagType::ID3v2));
|
||||
/// assert!(!bound_tagged_file.contains_tag_type(TagType::Id3v2));
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
pub struct BoundTaggedFile {
|
||||
|
@ -748,16 +748,16 @@ impl FileType {
|
|||
/// use lofty::{FileType, TagType};
|
||||
///
|
||||
/// let file_type = FileType::Mpeg;
|
||||
/// assert_eq!(file_type.primary_tag_type(), TagType::ID3v2);
|
||||
/// assert_eq!(file_type.primary_tag_type(), TagType::Id3v2);
|
||||
/// ```
|
||||
pub fn primary_tag_type(&self) -> TagType {
|
||||
match self {
|
||||
FileType::Aiff | FileType::Mpeg | FileType::Wav | FileType::Aac => TagType::ID3v2,
|
||||
FileType::Ape | FileType::WavPack => TagType::APE,
|
||||
FileType::Aiff | FileType::Mpeg | FileType::Wav | FileType::Aac => TagType::Id3v2,
|
||||
FileType::Ape | FileType::WavPack => TagType::Ape,
|
||||
FileType::Flac | FileType::Opus | FileType::Vorbis | FileType::Speex => {
|
||||
TagType::VorbisComments
|
||||
},
|
||||
FileType::Mp4 => TagType::MP4ilst,
|
||||
FileType::Mp4 => TagType::Mp4Ilst,
|
||||
FileType::Custom(c) => {
|
||||
let resolver = crate::resolve::lookup_resolver(c);
|
||||
resolver.primary_tag_type()
|
||||
|
@ -769,7 +769,7 @@ impl FileType {
|
|||
///
|
||||
/// NOTE: This is feature dependent, meaning if you do not have the
|
||||
/// `id3v2` feature enabled, [`FileType::Mpeg`] will return `false` for
|
||||
/// [`TagType::ID3v2`].
|
||||
/// [`TagType::Id3v2`].
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
|
@ -781,27 +781,27 @@ impl FileType {
|
|||
/// use lofty::{FileType, TagType};
|
||||
///
|
||||
/// let file_type = FileType::Mpeg;
|
||||
/// assert!(file_type.supports_tag_type(TagType::ID3v2));
|
||||
/// assert!(file_type.supports_tag_type(TagType::Id3v2));
|
||||
/// ```
|
||||
pub fn supports_tag_type(&self, tag_type: TagType) -> bool {
|
||||
match self {
|
||||
FileType::Aiff | FileType::Ape | FileType::Mpeg | FileType::Wav | FileType::Aac
|
||||
if tag_type == TagType::ID3v2 =>
|
||||
if tag_type == TagType::Id3v2 =>
|
||||
{
|
||||
true
|
||||
},
|
||||
FileType::Aiff if tag_type == TagType::AIFFText => true,
|
||||
FileType::Aiff if tag_type == TagType::AiffText => true,
|
||||
FileType::Ape | FileType::Mpeg | FileType::WavPack | FileType::Aac
|
||||
if tag_type == TagType::ID3v1 =>
|
||||
if tag_type == TagType::Id3v1 =>
|
||||
{
|
||||
true
|
||||
},
|
||||
FileType::Ape | FileType::Mpeg | FileType::WavPack if tag_type == TagType::APE => true,
|
||||
FileType::Ape | FileType::Mpeg | FileType::WavPack if tag_type == TagType::Ape => true,
|
||||
FileType::Opus | FileType::Flac | FileType::Vorbis | FileType::Speex => {
|
||||
tag_type == TagType::VorbisComments
|
||||
},
|
||||
FileType::Mp4 => tag_type == TagType::MP4ilst,
|
||||
FileType::Wav => tag_type == TagType::RIFFInfo,
|
||||
FileType::Mp4 => tag_type == TagType::Mp4Ilst,
|
||||
FileType::Wav => tag_type == TagType::RiffInfo,
|
||||
FileType::Custom(c) => {
|
||||
let resolver = crate::resolve::lookup_resolver(c);
|
||||
resolver.supported_tag_types().contains(&tag_type)
|
||||
|
|
|
@ -43,7 +43,7 @@ pub use properties::FlacProperties;
|
|||
#[lofty(no_into_taggedfile_impl)]
|
||||
pub struct FlacFile {
|
||||
/// An ID3v2 tag
|
||||
#[lofty(tag_type = "ID3v2")]
|
||||
#[lofty(tag_type = "Id3v2")]
|
||||
pub(crate) id3v2_tag: Option<ID3v2Tag>,
|
||||
/// The vorbis comments contained in the file
|
||||
#[lofty(tag_type = "VorbisComments")]
|
||||
|
|
|
@ -28,7 +28,7 @@ pub(crate) fn write_to(file: &mut File, tag: &Tag) -> Result<()> {
|
|||
write_to_inner(file, &mut comments_ref)
|
||||
},
|
||||
// This tag can *only* be removed in this format
|
||||
TagType::ID3v2 => crate::id3::v2::tag::Id3v2TagRef::empty().write_to(file),
|
||||
TagType::Id3v2 => crate::id3::v2::tag::Id3v2TagRef::empty().write_to(file),
|
||||
_ => err!(UnsupportedTag),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,11 +239,11 @@ impl TagExt for ID3v1Tag {
|
|||
}
|
||||
|
||||
fn remove_from_path<P: AsRef<Path>>(&self, path: P) -> std::result::Result<(), Self::Err> {
|
||||
TagType::ID3v1.remove_from_path(path)
|
||||
TagType::Id3v1.remove_from_path(path)
|
||||
}
|
||||
|
||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||
TagType::ID3v1.remove_from(file)
|
||||
TagType::Id3v1.remove_from(file)
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
|
@ -258,7 +258,7 @@ impl SplitTag for ID3v1Tag {
|
|||
type Remainder = SplitTagRemainder;
|
||||
|
||||
fn split_tag(mut self) -> (Self::Remainder, Tag) {
|
||||
let mut tag = Tag::new(TagType::ID3v1);
|
||||
let mut tag = Tag::new(TagType::Id3v1);
|
||||
|
||||
self.title
|
||||
.take()
|
||||
|
@ -455,7 +455,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn tag_to_id3v1() {
|
||||
let tag = crate::tag::utils::test_utils::create_tag(TagType::ID3v1);
|
||||
let tag = crate::tag::utils::test_utils::create_tag(TagType::Id3v1);
|
||||
|
||||
let id3v1_tag: ID3v1Tag = tag.into();
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ impl<'a> TryFrom<&'a ItemKey> for FrameID<'a> {
|
|||
Ok(Self::Valid(Cow::Borrowed(unknown)))
|
||||
},
|
||||
k => {
|
||||
if let Some(mapped) = k.map_key(TagType::ID3v2, false) {
|
||||
if let Some(mapped) = k.map_key(TagType::Id3v2, false) {
|
||||
if mapped.len() == 4 {
|
||||
Self::verify_id(mapped)?;
|
||||
return Ok(Self::Valid(Cow::Borrowed(mapped)));
|
||||
|
|
|
@ -375,7 +375,7 @@ impl From<TagItem> for Option<Frame<'static>> {
|
|||
|
||||
frame_id = id;
|
||||
},
|
||||
Err(_) => match input.item_key.map_key(TagType::ID3v2, true) {
|
||||
Err(_) => match input.item_key.map_key(TagType::Id3v2, true) {
|
||||
Some(desc) => match input.item_value {
|
||||
ItemValue::Text(text) => {
|
||||
frame_id = FrameID::Valid(Cow::Borrowed("TXXX"));
|
||||
|
@ -504,7 +504,7 @@ impl<'a> TryFrom<&'a TagItem> for FrameRef<'a> {
|
|||
frame_id = id;
|
||||
},
|
||||
Err(_) => {
|
||||
let Some(desc) = tag_item.key().map_key(TagType::ID3v2, true) else {
|
||||
let Some(desc) = tag_item.key().map_key(TagType::Id3v2, true) else {
|
||||
return Err(Id3v2Error::new(Id3v2ErrorKind::BadFrameID).into());
|
||||
};
|
||||
|
||||
|
|
|
@ -604,11 +604,11 @@ impl TagExt for ID3v2Tag {
|
|||
}
|
||||
|
||||
fn remove_from_path<P: AsRef<Path>>(&self, path: P) -> std::result::Result<(), Self::Err> {
|
||||
TagType::ID3v2.remove_from_path(path)
|
||||
TagType::Id3v2.remove_from_path(path)
|
||||
}
|
||||
|
||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||
TagType::ID3v2.remove_from(file)
|
||||
TagType::Id3v2.remove_from(file)
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
|
@ -684,7 +684,7 @@ impl SplitTag for ID3v2Tag {
|
|||
Some(())
|
||||
}
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
self.frames.retain_mut(|frame| {
|
||||
let id = &frame.id;
|
||||
|
@ -723,7 +723,7 @@ impl SplitTag for ID3v2Tag {
|
|||
..
|
||||
}),
|
||||
) => {
|
||||
let item_key = ItemKey::from_key(TagType::ID3v2, description);
|
||||
let item_key = ItemKey::from_key(TagType::Id3v2, description);
|
||||
for c in content.split(V4_MULTI_VALUE_SEPARATOR) {
|
||||
tag.items.push(TagItem::new(
|
||||
item_key.clone(),
|
||||
|
@ -740,7 +740,7 @@ impl SplitTag for ID3v2Tag {
|
|||
..
|
||||
}),
|
||||
) => {
|
||||
let item_key = ItemKey::from_key(TagType::ID3v2, description);
|
||||
let item_key = ItemKey::from_key(TagType::Id3v2, description);
|
||||
for c in content.split(V4_MULTI_VALUE_SEPARATOR) {
|
||||
tag.items.push(TagItem::new(
|
||||
item_key.clone(),
|
||||
|
@ -773,7 +773,7 @@ impl SplitTag for ID3v2Tag {
|
|||
}
|
||||
},
|
||||
(id, value) => {
|
||||
let item_key = ItemKey::from_key(TagType::ID3v2, id);
|
||||
let item_key = ItemKey::from_key(TagType::Id3v2, id);
|
||||
|
||||
let item_value = match value {
|
||||
FrameValue::Comment(CommentFrame {
|
||||
|
@ -921,7 +921,7 @@ impl MergeTag for SplitTagRemainder {
|
|||
&ItemKey::Lyrics,
|
||||
] {
|
||||
let frame_id = item_key
|
||||
.map_key(TagType::ID3v2, false)
|
||||
.map_key(TagType::Id3v2, false)
|
||||
.expect("valid frame id");
|
||||
if let Some(text) = join_text_items(&mut tag, [item_key].into_iter()) {
|
||||
let frame = new_text_frame(
|
||||
|
@ -938,11 +938,11 @@ impl MergeTag for SplitTagRemainder {
|
|||
// Multi-valued Label/Publisher key-to-frame mapping
|
||||
{
|
||||
let frame_id = ItemKey::Label
|
||||
.map_key(TagType::ID3v2, false)
|
||||
.map_key(TagType::Id3v2, false)
|
||||
.expect("valid frame id");
|
||||
debug_assert_eq!(
|
||||
Some(frame_id),
|
||||
ItemKey::Publisher.map_key(TagType::ID3v2, false)
|
||||
ItemKey::Publisher.map_key(TagType::Id3v2, false)
|
||||
);
|
||||
if let Some(text) = join_text_items(&mut tag, &[ItemKey::Label, ItemKey::Publisher]) {
|
||||
let frame = new_text_frame(
|
||||
|
@ -1239,7 +1239,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn tag_to_id3v2_popm() {
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
tag.insert(TagItem::new(
|
||||
ItemKey::Popularimeter,
|
||||
ItemValue::Binary(vec![
|
||||
|
@ -1310,7 +1310,7 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
let tag = crate::tag::utils::test_utils::create_tag(TagType::ID3v2);
|
||||
let tag = crate::tag::utils::test_utils::create_tag(TagType::Id3v2);
|
||||
|
||||
let id3v2_tag: ID3v2Tag = tag.into();
|
||||
|
||||
|
@ -1472,7 +1472,7 @@ mod tests {
|
|||
picture_data,
|
||||
);
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
tag.push_picture(picture.clone());
|
||||
|
||||
let mut writer = Vec::new();
|
||||
|
@ -1530,7 +1530,7 @@ mod tests {
|
|||
#[test]
|
||||
fn multi_item_tag_to_id3v2() {
|
||||
use crate::traits::Accessor;
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
tag.push_unchecked(TagItem::new(
|
||||
ItemKey::TrackArtist,
|
||||
|
@ -1584,7 +1584,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn multi_value_roundtrip() {
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
// 1st: Multi-valued text frames
|
||||
tag.insert_text(ItemKey::TrackArtist, "TrackArtist 1".to_owned());
|
||||
tag.push(TagItem::new(
|
||||
|
@ -1904,7 +1904,7 @@ mod tests {
|
|||
use crate::traits::Accessor;
|
||||
let track_number = 1;
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
tag.push(TagItem::new(
|
||||
ItemKey::TrackNumber,
|
||||
|
@ -1922,7 +1922,7 @@ mod tests {
|
|||
use crate::traits::Accessor;
|
||||
let track_total = 2;
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
tag.push(TagItem::new(
|
||||
ItemKey::TrackTotal,
|
||||
|
@ -1941,7 +1941,7 @@ mod tests {
|
|||
let track_number = 1;
|
||||
let track_total = 2;
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
tag.push(TagItem::new(
|
||||
ItemKey::TrackNumber,
|
||||
|
@ -1964,7 +1964,7 @@ mod tests {
|
|||
use crate::traits::Accessor;
|
||||
let disk_number = 1;
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
tag.push(TagItem::new(
|
||||
ItemKey::DiscNumber,
|
||||
|
@ -1982,7 +1982,7 @@ mod tests {
|
|||
use crate::traits::Accessor;
|
||||
let disk_total = 2;
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
tag.push(TagItem::new(
|
||||
ItemKey::DiscTotal,
|
||||
|
@ -2001,7 +2001,7 @@ mod tests {
|
|||
let disk_number = 1;
|
||||
let disk_total = 2;
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
tag.push(TagItem::new(
|
||||
ItemKey::DiscNumber,
|
||||
|
|
|
@ -19,10 +19,10 @@ pub use tag::{AIFFTextChunks, Comment};
|
|||
#[lofty(internal_write_module_do_not_use_anywhere_else)]
|
||||
pub struct AiffFile {
|
||||
/// Any text chunks included in the file
|
||||
#[lofty(tag_type = "AIFFText")]
|
||||
#[lofty(tag_type = "AiffText")]
|
||||
pub(crate) text_chunks_tag: Option<AIFFTextChunks>,
|
||||
/// An ID3v2 tag
|
||||
#[lofty(tag_type = "ID3v2")]
|
||||
#[lofty(tag_type = "Id3v2")]
|
||||
pub(crate) id3v2_tag: Option<ID3v2Tag>,
|
||||
/// The file's audio properties
|
||||
pub(crate) properties: FileProperties,
|
||||
|
|
|
@ -209,11 +209,11 @@ impl TagExt for AIFFTextChunks {
|
|||
}
|
||||
|
||||
fn remove_from_path<P: AsRef<Path>>(&self, path: P) -> std::result::Result<(), Self::Err> {
|
||||
TagType::AIFFText.remove_from_path(path)
|
||||
TagType::AiffText.remove_from_path(path)
|
||||
}
|
||||
|
||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||
TagType::AIFFText.remove_from(file)
|
||||
TagType::AiffText.remove_from(file)
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
|
@ -242,7 +242,7 @@ impl MergeTag for SplitTagRemainder {
|
|||
|
||||
impl From<AIFFTextChunks> for Tag {
|
||||
fn from(input: AIFFTextChunks) -> Self {
|
||||
let mut tag = Self::new(TagType::AIFFText);
|
||||
let mut tag = Self::new(TagType::AiffText);
|
||||
|
||||
let push_item = |field: Option<String>, item_key: ItemKey, tag: &mut Tag| {
|
||||
if let Some(text) = field {
|
||||
|
@ -567,7 +567,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn tag_to_aiff_text() {
|
||||
let mut tag = Tag::new(TagType::AIFFText);
|
||||
let mut tag = Tag::new(TagType::AiffText);
|
||||
tag.insert_text(ItemKey::TrackTitle, String::from("Foo title"));
|
||||
tag.insert_text(ItemKey::TrackArtist, String::from("Bar artist"));
|
||||
tag.insert_text(ItemKey::CopyrightMessage, String::from("Baz copyright"));
|
||||
|
|
|
@ -18,10 +18,10 @@ pub use tag::RIFFInfoList;
|
|||
#[lofty(internal_write_module_do_not_use_anywhere_else)]
|
||||
pub struct WavFile {
|
||||
/// A RIFF INFO LIST
|
||||
#[lofty(tag_type = "RIFFInfo")]
|
||||
#[lofty(tag_type = "RiffInfo")]
|
||||
pub(crate) riff_info_tag: Option<RIFFInfoList>,
|
||||
/// An ID3v2 tag
|
||||
#[lofty(tag_type = "ID3v2")]
|
||||
#[lofty(tag_type = "Id3v2")]
|
||||
pub(crate) id3v2_tag: Option<ID3v2Tag>,
|
||||
/// The file's audio properties
|
||||
pub(crate) properties: WavProperties,
|
||||
|
|
|
@ -210,11 +210,11 @@ impl TagExt for RIFFInfoList {
|
|||
}
|
||||
|
||||
fn remove_from_path<P: AsRef<Path>>(&self, path: P) -> std::result::Result<(), Self::Err> {
|
||||
TagType::RIFFInfo.remove_from_path(path)
|
||||
TagType::RiffInfo.remove_from_path(path)
|
||||
}
|
||||
|
||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||
TagType::RIFFInfo.remove_from(file)
|
||||
TagType::RiffInfo.remove_from(file)
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
|
@ -243,10 +243,10 @@ impl MergeTag for SplitTagRemainder {
|
|||
|
||||
impl From<RIFFInfoList> for Tag {
|
||||
fn from(input: RIFFInfoList) -> Self {
|
||||
let mut tag = Self::new(TagType::RIFFInfo);
|
||||
let mut tag = Self::new(TagType::RiffInfo);
|
||||
|
||||
for (k, v) in input.items {
|
||||
let item_key = ItemKey::from_key(TagType::RIFFInfo, &k);
|
||||
let item_key = ItemKey::from_key(TagType::RiffInfo, &k);
|
||||
|
||||
tag.items.push(TagItem::new(
|
||||
item_key,
|
||||
|
@ -271,7 +271,7 @@ impl From<Tag> for RIFFInfoList {
|
|||
}
|
||||
},
|
||||
k => {
|
||||
if let Some(key) = k.map_key(TagType::RIFFInfo, false) {
|
||||
if let Some(key) = k.map_key(TagType::RiffInfo, false) {
|
||||
riff_info.items.push((key.to_string(), val))
|
||||
}
|
||||
},
|
||||
|
@ -316,7 +316,7 @@ pub(crate) fn tagitems_into_riff<'a>(
|
|||
items: impl IntoIterator<Item = &'a TagItem>,
|
||||
) -> impl Iterator<Item = (&'a str, &'a str)> {
|
||||
items.into_iter().filter_map(|i| {
|
||||
let item_key = i.key().map_key(TagType::RIFFInfo, true);
|
||||
let item_key = i.key().map_key(TagType::RiffInfo, true);
|
||||
|
||||
match (item_key, i.value()) {
|
||||
(Some(key), ItemValue::Text(val) | ItemValue::Locator(val))
|
||||
|
@ -415,7 +415,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn tag_to_riff_info() {
|
||||
let tag = crate::tag::utils::test_utils::create_tag(TagType::RIFFInfo);
|
||||
let tag = crate::tag::utils::test_utils::create_tag(TagType::RiffInfo);
|
||||
|
||||
let riff_info: RIFFInfoList = tag.into();
|
||||
|
||||
|
|
|
@ -88,8 +88,8 @@
|
|||
//! assert_eq!(mp3_file.properties().channels(), 2);
|
||||
//!
|
||||
//! // Here we have a file with multiple tags
|
||||
//! assert!(mp3_file.contains_tag_type(TagType::ID3v2));
|
||||
//! assert!(mp3_file.contains_tag_type(TagType::APE));
|
||||
//! assert!(mp3_file.contains_tag_type(TagType::Id3v2));
|
||||
//! assert!(mp3_file.contains_tag_type(TagType::Ape));
|
||||
//! # Ok(())
|
||||
//! # }
|
||||
//! ```
|
||||
|
|
|
@ -66,7 +66,7 @@ impl<'a> TryFrom<&'a ItemKey> for AtomIdent<'a> {
|
|||
type Error = LoftyError;
|
||||
|
||||
fn try_from(value: &'a ItemKey) -> std::result::Result<Self, Self::Error> {
|
||||
if let Some(mapped_key) = value.map_key(TagType::MP4ilst, true) {
|
||||
if let Some(mapped_key) = value.map_key(TagType::Mp4Ilst, true) {
|
||||
if mapped_key.starts_with("----") {
|
||||
let mut split = mapped_key.split(':');
|
||||
|
||||
|
|
|
@ -435,11 +435,11 @@ impl TagExt for Ilst {
|
|||
}
|
||||
|
||||
fn remove_from_path<P: AsRef<Path>>(&self, path: P) -> std::result::Result<(), Self::Err> {
|
||||
TagType::MP4ilst.remove_from_path(path)
|
||||
TagType::Mp4Ilst.remove_from_path(path)
|
||||
}
|
||||
|
||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||
TagType::MP4ilst.remove_from(file)
|
||||
TagType::Mp4Ilst.remove_from(file)
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
|
@ -468,7 +468,7 @@ impl SplitTag for Ilst {
|
|||
type Remainder = SplitTagRemainder;
|
||||
|
||||
fn split_tag(mut self) -> (Self::Remainder, Tag) {
|
||||
let mut tag = Tag::new(TagType::MP4ilst);
|
||||
let mut tag = Tag::new(TagType::Mp4Ilst);
|
||||
|
||||
self.atoms.retain_mut(|atom| {
|
||||
let Atom { ident, data } = atom;
|
||||
|
@ -517,7 +517,7 @@ impl SplitTag for Ilst {
|
|||
};
|
||||
|
||||
let key = ItemKey::from_key(
|
||||
TagType::MP4ilst,
|
||||
TagType::Mp4Ilst,
|
||||
&match ident {
|
||||
AtomIdent::Fourcc(fourcc) => {
|
||||
fourcc.iter().map(|b| *b as char).collect::<String>()
|
||||
|
@ -768,7 +768,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn tag_to_ilst() {
|
||||
let mut tag = crate::tag::utils::test_utils::create_tag(TagType::MP4ilst);
|
||||
let mut tag = crate::tag::utils::test_utils::create_tag(TagType::Mp4Ilst);
|
||||
|
||||
tag.insert_text(ItemKey::DiscNumber, String::from("1"));
|
||||
tag.insert_text(ItemKey::DiscTotal, String::from("2"));
|
||||
|
@ -974,7 +974,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn multi_value_roundtrip() {
|
||||
let mut tag = Tag::new(TagType::MP4ilst);
|
||||
let mut tag = Tag::new(TagType::Mp4Ilst);
|
||||
tag.insert_text(ItemKey::TrackArtist, "TrackArtist 1".to_owned());
|
||||
tag.push(TagItem::new(
|
||||
ItemKey::TrackArtist,
|
||||
|
|
|
@ -33,7 +33,7 @@ pub(crate) use properties::SAMPLE_RATES;
|
|||
pub struct Mp4File {
|
||||
/// The file format from ftyp's "major brand" (Ex. "M4A ")
|
||||
pub(crate) ftyp: String,
|
||||
#[lofty(tag_type = "MP4ilst")]
|
||||
#[lofty(tag_type = "Mp4Ilst")]
|
||||
/// The parsed `ilst` (metadata) atom, if it exists
|
||||
pub(crate) ilst_tag: Option<Ilst>,
|
||||
/// The file's audio properties
|
||||
|
|
|
@ -19,13 +19,13 @@ use lofty_attr::LoftyFile;
|
|||
#[lofty(internal_write_module_do_not_use_anywhere_else)]
|
||||
pub struct MPEGFile {
|
||||
/// An ID3v2 tag
|
||||
#[lofty(tag_type = "ID3v2")]
|
||||
#[lofty(tag_type = "Id3v2")]
|
||||
pub(crate) id3v2_tag: Option<ID3v2Tag>,
|
||||
/// An ID3v1 tag
|
||||
#[lofty(tag_type = "ID3v1")]
|
||||
#[lofty(tag_type = "Id3v1")]
|
||||
pub(crate) id3v1_tag: Option<ID3v1Tag>,
|
||||
/// An APEv1/v2 tag
|
||||
#[lofty(tag_type = "APE")]
|
||||
#[lofty(tag_type = "Ape")]
|
||||
pub(crate) ape_tag: Option<ApeTag>,
|
||||
/// The file's audio properties
|
||||
pub(crate) properties: MPEGProperties,
|
||||
|
|
|
@ -147,7 +147,7 @@ mod tests {
|
|||
#[lofty(read_fn = "Self::read")]
|
||||
#[lofty(file_type = "MyFile")]
|
||||
struct MyFile {
|
||||
#[lofty(tag_type = "ID3v2")]
|
||||
#[lofty(tag_type = "Id3v2")]
|
||||
id3v2_tag: Option<ID3v2Tag>,
|
||||
properties: FileProperties,
|
||||
}
|
||||
|
@ -158,11 +158,11 @@ mod tests {
|
|||
}
|
||||
|
||||
fn primary_tag_type() -> TagType {
|
||||
TagType::ID3v2
|
||||
TagType::Id3v2
|
||||
}
|
||||
|
||||
fn supported_tag_types() -> &'static [TagType] {
|
||||
&[TagType::ID3v2]
|
||||
&[TagType::Id3v2]
|
||||
}
|
||||
|
||||
fn guess(buf: &[u8]) -> Option<FileType> {
|
||||
|
|
|
@ -471,15 +471,15 @@ macro_rules! gen_item_keys {
|
|||
|
||||
gen_item_keys!(
|
||||
MAPS => [
|
||||
[TagType::AIFFText, AIFF_TEXT_MAP],
|
||||
[TagType::AiffText, AIFF_TEXT_MAP],
|
||||
|
||||
[TagType::APE, APE_MAP],
|
||||
[TagType::Ape, APE_MAP],
|
||||
|
||||
[TagType::ID3v2, ID3V2_MAP],
|
||||
[TagType::Id3v2, ID3V2_MAP],
|
||||
|
||||
[TagType::MP4ilst, ILST_MAP],
|
||||
[TagType::Mp4Ilst, ILST_MAP],
|
||||
|
||||
[TagType::RIFFInfo, RIFF_INFO_MAP],
|
||||
[TagType::RiffInfo, RIFF_INFO_MAP],
|
||||
|
||||
[TagType::VorbisComments, VORBIS_MAP]
|
||||
];
|
||||
|
@ -770,7 +770,7 @@ impl TagItem {
|
|||
}
|
||||
|
||||
pub(crate) fn re_map(&self, tag_type: TagType) -> bool {
|
||||
if tag_type == TagType::ID3v1 {
|
||||
if tag_type == TagType::Id3v1 {
|
||||
use crate::id3::v1::constants::VALID_ITEMKEYS;
|
||||
|
||||
return VALID_ITEMKEYS.contains(&self.item_key);
|
||||
|
|
|
@ -58,7 +58,7 @@ macro_rules! impl_accessor {
|
|||
/// ```rust
|
||||
/// use lofty::{Accessor, Tag, TagType};
|
||||
///
|
||||
/// let tag = Tag::new(TagType::ID3v2);
|
||||
/// let tag = Tag::new(TagType::Id3v2);
|
||||
///
|
||||
/// // There are multiple quick getter methods for common items
|
||||
///
|
||||
|
@ -73,7 +73,7 @@ macro_rules! impl_accessor {
|
|||
/// ```rust
|
||||
/// use lofty::{ItemKey, Tag, TagType};
|
||||
///
|
||||
/// let tag = Tag::new(TagType::ID3v2);
|
||||
/// let tag = Tag::new(TagType::Id3v2);
|
||||
///
|
||||
/// // If the type of an item is known, there are getter methods
|
||||
/// // to prevent having to match against the value
|
||||
|
@ -91,7 +91,7 @@ macro_rules! impl_accessor {
|
|||
/// // Converting between formats is as simple as an `into` call.
|
||||
/// // However, such conversions can potentially be *very* lossy.
|
||||
///
|
||||
/// let tag = Tag::new(TagType::ID3v2);
|
||||
/// let tag = Tag::new(TagType::Id3v2);
|
||||
/// let id3v2_tag: ID3v2Tag = tag.into();
|
||||
/// ```
|
||||
#[derive(Clone)]
|
||||
|
@ -467,7 +467,7 @@ impl Tag {
|
|||
/// # let front_cover = Picture::new_unchecked(PictureType::CoverFront, MimeType::Png, None, Vec::new());
|
||||
/// # let back_cover = Picture::new_unchecked(PictureType::CoverBack, MimeType::Png, None, Vec::new());
|
||||
/// # let another_picture = Picture::new_unchecked(PictureType::Band, MimeType::Png, None, Vec::new());
|
||||
/// let mut tag = Tag::new(TagType::ID3v2);
|
||||
/// let mut tag = Tag::new(TagType::Id3v2);
|
||||
///
|
||||
/// // Add a front cover
|
||||
/// tag.push_picture(front_cover);
|
||||
|
@ -507,7 +507,7 @@ impl Tag {
|
|||
/// # use lofty::{PictureType, MimeType};
|
||||
///
|
||||
/// # let picture = Picture::new_unchecked(PictureType::CoverFront, MimeType::Png, None, Vec::new());
|
||||
/// let mut tag = Tag::new(TagType::ID3v2);
|
||||
/// let mut tag = Tag::new(TagType::Id3v2);
|
||||
/// tag.push_picture(picture);
|
||||
///
|
||||
/// assert_eq!(tag.pictures().len(), 1);
|
||||
|
@ -610,19 +610,19 @@ impl MergeTag for SplitTagRemainder {
|
|||
#[non_exhaustive]
|
||||
pub enum TagType {
|
||||
/// This covers both APEv1 and APEv2 as it doesn't matter much
|
||||
APE,
|
||||
Ape,
|
||||
/// Represents an ID3v1 tag
|
||||
ID3v1,
|
||||
Id3v1,
|
||||
/// This covers all ID3v2 versions since they all get upgraded to ID3v2.4
|
||||
ID3v2,
|
||||
Id3v2,
|
||||
/// Represents an MP4 ilst atom
|
||||
MP4ilst,
|
||||
Mp4Ilst,
|
||||
/// Represents vorbis comments
|
||||
VorbisComments,
|
||||
/// Represents a RIFF INFO LIST
|
||||
RIFFInfo,
|
||||
RiffInfo,
|
||||
/// Represents AIFF text chunks
|
||||
AIFFText,
|
||||
AiffText,
|
||||
}
|
||||
|
||||
impl TagType {
|
||||
|
@ -652,7 +652,7 @@ impl TagType {
|
|||
};
|
||||
|
||||
let special_exceptions =
|
||||
(file_type == FileType::Ape || file_type == FileType::Flac) && *self == TagType::ID3v2;
|
||||
(file_type == FileType::Ape || file_type == FileType::Flac) && *self == TagType::Id3v2;
|
||||
|
||||
if !special_exceptions && !file_type.supports_tag_type(*self) {
|
||||
err!(UnsupportedTag);
|
||||
|
@ -743,7 +743,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn should_preserve_empty_title() {
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
tag.set_title(String::from("Foo title"));
|
||||
|
||||
assert_eq!(tag.title().as_deref(), Some("Foo title"));
|
||||
|
|
|
@ -39,18 +39,18 @@ pub(crate) fn write_tag(tag: &Tag, file: &mut File, file_type: FileType) -> Resu
|
|||
#[allow(unreachable_patterns)]
|
||||
pub(crate) fn dump_tag<W: Write>(tag: &Tag, writer: &mut W) -> Result<()> {
|
||||
match tag.tag_type() {
|
||||
TagType::APE => ApeTagRef {
|
||||
TagType::Ape => ApeTagRef {
|
||||
read_only: false,
|
||||
items: ape::tag::tagitems_into_ape(tag.items()),
|
||||
}
|
||||
.dump_to(writer),
|
||||
TagType::ID3v1 => Into::<Id3v1TagRef<'_>>::into(tag).dump_to(writer),
|
||||
TagType::ID3v2 => Id3v2TagRef {
|
||||
TagType::Id3v1 => Into::<Id3v1TagRef<'_>>::into(tag).dump_to(writer),
|
||||
TagType::Id3v2 => Id3v2TagRef {
|
||||
flags: ID3v2TagFlags::default(),
|
||||
frames: v2::tag::tag_frames(tag),
|
||||
}
|
||||
.dump_to(writer),
|
||||
TagType::MP4ilst => Into::<Ilst>::into(tag.clone()).as_ref().dump_to(writer),
|
||||
TagType::Mp4Ilst => Into::<Ilst>::into(tag.clone()).as_ref().dump_to(writer),
|
||||
TagType::VorbisComments => {
|
||||
let (vendor, items, pictures) = create_vorbis_comments_ref(tag);
|
||||
|
||||
|
@ -61,11 +61,11 @@ pub(crate) fn dump_tag<W: Write>(tag: &Tag, writer: &mut W) -> Result<()> {
|
|||
}
|
||||
.dump_to(writer)
|
||||
},
|
||||
TagType::RIFFInfo => RIFFInfoListRef {
|
||||
TagType::RiffInfo => RIFFInfoListRef {
|
||||
items: iff::wav::tag::tagitems_into_riff(tag.items()),
|
||||
}
|
||||
.dump_to(writer),
|
||||
TagType::AIFFText => {
|
||||
TagType::AiffText => {
|
||||
use crate::tag::item::ItemKey;
|
||||
|
||||
AiffTextChunksRef {
|
||||
|
|
|
@ -59,9 +59,8 @@ macro_rules! accessor_trait {
|
|||
/// ```rust
|
||||
/// use lofty::{Tag, Accessor};
|
||||
///
|
||||
/// # let tag_type = lofty::TagType::ID3v2;
|
||||
/// let mut tag = Tag::new(tag_type);
|
||||
///
|
||||
/// # let tag_type = lofty::TagType::Id3v2;
|
||||
/// let mut tag = Tag::new(tag_type); ///
|
||||
#[doc = "assert_eq!(tag." $name $(_ $other)* "(), None);"]
|
||||
/// ```
|
||||
fn [<
|
||||
|
@ -146,7 +145,7 @@ pub trait TagExt: Accessor + Into<Tag> + Sized {
|
|||
///
|
||||
/// ```rust
|
||||
/// use lofty::{Accessor, ItemKey, Tag, TagExt};
|
||||
/// # let tag_type = lofty::TagType::ID3v2;
|
||||
/// # let tag_type = lofty::TagType::Id3v2;
|
||||
///
|
||||
/// let mut tag = Tag::new(tag_type);
|
||||
/// assert_eq!(tag.len(), 0);
|
||||
|
@ -162,7 +161,7 @@ pub trait TagExt: Accessor + Into<Tag> + Sized {
|
|||
///
|
||||
/// ```rust
|
||||
/// use lofty::{Accessor, ItemKey, Tag, TagExt};
|
||||
/// # let tag_type = lofty::TagType::ID3v2;
|
||||
/// # let tag_type = lofty::TagType::Id3v2;
|
||||
///
|
||||
/// let mut tag = Tag::new(tag_type);
|
||||
/// assert!(tag.is_empty());
|
||||
|
@ -178,7 +177,7 @@ pub trait TagExt: Accessor + Into<Tag> + Sized {
|
|||
///
|
||||
/// ```rust
|
||||
/// use lofty::{Accessor, Tag, TagExt};
|
||||
/// # let tag_type = lofty::TagType::ID3v2;
|
||||
/// # let tag_type = lofty::TagType::Id3v2;
|
||||
///
|
||||
/// let mut tag = Tag::new(tag_type);
|
||||
/// assert!(tag.is_empty());
|
||||
|
|
|
@ -16,10 +16,10 @@ pub use properties::WavPackProperties;
|
|||
#[lofty(internal_write_module_do_not_use_anywhere_else)]
|
||||
pub struct WavPackFile {
|
||||
/// An ID3v1 tag
|
||||
#[lofty(tag_type = "ID3v1")]
|
||||
#[lofty(tag_type = "Id3v1")]
|
||||
pub(crate) id3v1_tag: Option<ID3v1Tag>,
|
||||
/// An APEv1/v2 tag
|
||||
#[lofty(tag_type = "APE")]
|
||||
#[lofty(tag_type = "Ape")]
|
||||
pub(crate) ape_tag: Option<ApeTag>,
|
||||
/// The file's audio properties
|
||||
pub(crate) properties: WavPackProperties,
|
||||
|
|
|
@ -20,7 +20,7 @@ fn read() {
|
|||
crate::verify_artist!(file, primary_tag, "Foo artist", 1);
|
||||
|
||||
// Now verify ID3v1
|
||||
crate::verify_artist!(file, tag, TagType::ID3v1, "Bar artist", 1);
|
||||
crate::verify_artist!(file, tag, TagType::Id3v1, "Bar artist", 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -69,7 +69,7 @@ fn write() {
|
|||
crate::set_artist!(tagged_file, primary_tag_mut, "Foo artist", 1 => file, "Bar artist");
|
||||
|
||||
// ID3v1
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::ID3v1, "Bar artist", 1 => file, "Baz artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Bar artist", 1 => file, "Baz artist");
|
||||
|
||||
// Now reread the file
|
||||
file.rewind().unwrap();
|
||||
|
@ -82,15 +82,15 @@ fn write() {
|
|||
|
||||
crate::set_artist!(tagged_file, primary_tag_mut, "Bar artist", 1 => file, "Foo artist");
|
||||
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::ID3v1, "Baz artist", 1 => file, "Bar artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Baz artist", 1 => file, "Bar artist");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_id3v2() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.aac", TagType::ID3v2);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.aac", TagType::Id3v2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_id3v1() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.aac", TagType::ID3v1);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.aac", TagType::Id3v1);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ fn read() {
|
|||
crate::verify_artist!(file, primary_tag, "Foo artist", 1);
|
||||
|
||||
// Now verify the text chunks
|
||||
crate::verify_artist!(file, tag, TagType::AIFFText, "Bar artist", 1);
|
||||
crate::verify_artist!(file, tag, TagType::AiffText, "Bar artist", 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -39,7 +39,7 @@ fn write() {
|
|||
crate::set_artist!(tagged_file, primary_tag_mut, "Foo artist", 1 => file, "Bar artist");
|
||||
|
||||
// Text chunks
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::AIFFText, "Bar artist", 1 => file, "Baz artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::AiffText, "Bar artist", 1 => file, "Baz artist");
|
||||
|
||||
// Now reread the file
|
||||
file.rewind().unwrap();
|
||||
|
@ -52,18 +52,18 @@ fn write() {
|
|||
|
||||
crate::set_artist!(tagged_file, primary_tag_mut, "Bar artist", 1 => file, "Foo artist");
|
||||
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::AIFFText, "Baz artist", 1 => file, "Bar artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::AiffText, "Baz artist", 1 => file, "Bar artist");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_text_chunks() {
|
||||
crate::remove_tag!(
|
||||
"tests/files/assets/minimal/full_test.aiff",
|
||||
TagType::AIFFText
|
||||
TagType::AiffText
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_id3v2() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.aiff", TagType::ID3v2);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.aiff", TagType::Id3v2);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@ fn read() {
|
|||
crate::verify_artist!(file, primary_tag, "Foo artist", 1);
|
||||
|
||||
// Now verify ID3v1
|
||||
crate::verify_artist!(file, tag, TagType::ID3v1, "Bar artist", 1);
|
||||
crate::verify_artist!(file, tag, TagType::Id3v1, "Bar artist", 1);
|
||||
|
||||
// Finally, verify ID3v2
|
||||
crate::verify_artist!(file, tag, TagType::ID3v2, "Baz artist", 1);
|
||||
crate::verify_artist!(file, tag, TagType::Id3v2, "Baz artist", 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -43,7 +43,7 @@ fn write() {
|
|||
crate::set_artist!(tagged_file, primary_tag_mut, "Foo artist", 1 => file, "Bar artist");
|
||||
|
||||
// ID3v1
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::ID3v1, "Bar artist", 1 => file, "Baz artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Bar artist", 1 => file, "Baz artist");
|
||||
|
||||
// Now reread the file
|
||||
file.rewind().unwrap();
|
||||
|
@ -56,20 +56,20 @@ fn write() {
|
|||
|
||||
crate::set_artist!(tagged_file, primary_tag_mut, "Bar artist", 1 => file, "Foo artist");
|
||||
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::ID3v1, "Baz artist", 1 => file, "Bar artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Baz artist", 1 => file, "Bar artist");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_ape() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.ape", TagType::APE);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.ape", TagType::Ape);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_id3v1() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.ape", TagType::ID3v1);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.ape", TagType::Id3v1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_id3v2() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.ape", TagType::ID3v2);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.ape", TagType::Id3v2);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ fn write() {
|
|||
assert_eq!(tagged_file.file_type(), FileType::Mp4);
|
||||
|
||||
// ilst
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::MP4ilst, "Foo artist", 1 => file, "Bar artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Mp4Ilst, "Foo artist", 1 => file, "Bar artist");
|
||||
|
||||
// Now reread the file
|
||||
file.rewind().unwrap();
|
||||
|
@ -45,13 +45,13 @@ fn write() {
|
|||
.read()
|
||||
.unwrap();
|
||||
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::MP4ilst, "Bar artist", 1 => file, "Foo artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Mp4Ilst, "Bar artist", 1 => file, "Foo artist");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove() {
|
||||
crate::remove_tag!(
|
||||
"tests/files/assets/minimal/m4a_codec_aac.m4a",
|
||||
TagType::MP4ilst
|
||||
TagType::Mp4Ilst
|
||||
);
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ fn read() {
|
|||
crate::verify_artist!(file, primary_tag, "Foo artist", 1);
|
||||
|
||||
// Now verify ID3v1
|
||||
crate::verify_artist!(file, tag, TagType::ID3v1, "Bar artist", 1);
|
||||
crate::verify_artist!(file, tag, TagType::Id3v1, "Bar artist", 1);
|
||||
|
||||
// Finally, verify APEv2
|
||||
crate::verify_artist!(file, tag, TagType::APE, "Baz artist", 1);
|
||||
crate::verify_artist!(file, tag, TagType::Ape, "Baz artist", 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -105,10 +105,10 @@ fn write() {
|
|||
crate::set_artist!(tagged_file, primary_tag_mut, "Foo artist", 1 => file, "Bar artist");
|
||||
|
||||
// ID3v1
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::ID3v1, "Bar artist", 1 => file, "Baz artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Bar artist", 1 => file, "Baz artist");
|
||||
|
||||
// APEv2
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::APE, "Baz artist", 1 => file, "Qux artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Ape, "Baz artist", 1 => file, "Qux artist");
|
||||
|
||||
// Now reread the file
|
||||
file.rewind().unwrap();
|
||||
|
@ -121,9 +121,9 @@ fn write() {
|
|||
|
||||
crate::set_artist!(tagged_file, primary_tag_mut, "Bar artist", 1 => file, "Foo artist");
|
||||
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::ID3v1, "Baz artist", 1 => file, "Bar artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Baz artist", 1 => file, "Bar artist");
|
||||
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::APE, "Qux artist", 1 => file, "Baz artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::Ape, "Qux artist", 1 => file, "Baz artist");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -139,7 +139,7 @@ fn save_to_id3v2() {
|
|||
|
||||
assert_eq!(tagged_file.file_type(), FileType::Mpeg);
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
// Set title to save this tag.
|
||||
tag.set_title("title".to_string());
|
||||
|
@ -156,7 +156,7 @@ fn save_to_id3v2() {
|
|||
.read()
|
||||
.unwrap();
|
||||
|
||||
let tag = tagged_file.tag(TagType::ID3v2).unwrap();
|
||||
let tag = tagged_file.tag(TagType::Id3v2).unwrap();
|
||||
|
||||
assert!(tag.track().is_none());
|
||||
assert!(tag.track_total().is_none());
|
||||
|
@ -177,7 +177,7 @@ fn save_number_of_track_and_disk_to_id3v2() {
|
|||
|
||||
assert_eq!(tagged_file.file_type(), FileType::Mpeg);
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
let track = 1;
|
||||
let disk = 2;
|
||||
|
@ -197,7 +197,7 @@ fn save_number_of_track_and_disk_to_id3v2() {
|
|||
.read()
|
||||
.unwrap();
|
||||
|
||||
let tag = tagged_file.tag(TagType::ID3v2).unwrap();
|
||||
let tag = tagged_file.tag(TagType::Id3v2).unwrap();
|
||||
|
||||
assert_eq!(tag.track().unwrap(), track);
|
||||
assert!(tag.track_total().is_none());
|
||||
|
@ -218,7 +218,7 @@ fn save_total_of_track_and_disk_to_id3v2() {
|
|||
|
||||
assert_eq!(tagged_file.file_type(), FileType::Mpeg);
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
let track_total = 2;
|
||||
let disk_total = 3;
|
||||
|
@ -238,7 +238,7 @@ fn save_total_of_track_and_disk_to_id3v2() {
|
|||
.read()
|
||||
.unwrap();
|
||||
|
||||
let tag = tagged_file.tag(TagType::ID3v2).unwrap();
|
||||
let tag = tagged_file.tag(TagType::Id3v2).unwrap();
|
||||
|
||||
assert_eq!(tag.track().unwrap(), 0);
|
||||
assert_eq!(tag.track_total().unwrap(), track_total);
|
||||
|
@ -259,7 +259,7 @@ fn save_number_pair_of_track_and_disk_to_id3v2() {
|
|||
|
||||
assert_eq!(tagged_file.file_type(), FileType::Mpeg);
|
||||
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
|
||||
let track = 1;
|
||||
let track_total = 2;
|
||||
|
@ -284,7 +284,7 @@ fn save_number_pair_of_track_and_disk_to_id3v2() {
|
|||
.read()
|
||||
.unwrap();
|
||||
|
||||
let tag = tagged_file.tag(TagType::ID3v2).unwrap();
|
||||
let tag = tagged_file.tag(TagType::Id3v2).unwrap();
|
||||
|
||||
assert_eq!(tag.track().unwrap(), track);
|
||||
assert_eq!(tag.track_total().unwrap(), track_total);
|
||||
|
@ -294,15 +294,15 @@ fn save_number_pair_of_track_and_disk_to_id3v2() {
|
|||
|
||||
#[test]
|
||||
fn remove_id3v2() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.mp3", TagType::ID3v2);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.mp3", TagType::Id3v2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_id3v1() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.mp3", TagType::ID3v1);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.mp3", TagType::Id3v1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_ape() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.mp3", TagType::APE);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.mp3", TagType::Ape);
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ fn flac_with_id3v2() {
|
|||
|
||||
#[test]
|
||||
fn flac_remove_id3v2() {
|
||||
crate::remove_tag!("tests/files/assets/flac_with_id3v2.flac", TagType::ID3v2);
|
||||
crate::remove_tag!("tests/files/assets/flac_with_id3v2.flac", TagType::Id3v2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -19,7 +19,7 @@ fn read() {
|
|||
crate::verify_artist!(file, primary_tag, "Foo artist", 1);
|
||||
|
||||
// Now verify the RIFF INFO chunk
|
||||
crate::verify_artist!(file, tag, TagType::RIFFInfo, "Bar artist", 1);
|
||||
crate::verify_artist!(file, tag, TagType::RiffInfo, "Bar artist", 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -39,7 +39,7 @@ fn write() {
|
|||
crate::set_artist!(tagged_file, primary_tag_mut, "Foo artist", 1 => file, "Bar artist");
|
||||
|
||||
// RIFF INFO
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::RIFFInfo, "Bar artist", 1 => file, "Baz artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::RiffInfo, "Bar artist", 1 => file, "Baz artist");
|
||||
|
||||
// Now reread the file
|
||||
file.rewind().unwrap();
|
||||
|
@ -52,14 +52,14 @@ fn write() {
|
|||
|
||||
crate::set_artist!(tagged_file, primary_tag_mut, "Bar artist", 1 => file, "Foo artist");
|
||||
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::RIFFInfo, "Baz artist", 1 => file, "Bar artist");
|
||||
crate::set_artist!(tagged_file, tag_mut, TagType::RiffInfo, "Baz artist", 1 => file, "Bar artist");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_id3v2() {
|
||||
crate::remove_tag!(
|
||||
"tests/files/assets/minimal/wav_format_pcm.wav",
|
||||
TagType::ID3v2
|
||||
TagType::Id3v2
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ fn remove_id3v2() {
|
|||
fn remove_riff_info() {
|
||||
crate::remove_tag!(
|
||||
"tests/files/assets/minimal/wav_format_pcm.wav",
|
||||
TagType::RIFFInfo
|
||||
TagType::RiffInfo
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ fn read() {
|
|||
crate::verify_artist!(file, primary_tag, "Foo artist", 1);
|
||||
|
||||
// Now verify the ID3v1 tag
|
||||
crate::verify_artist!(file, tag, TagType::ID3v1, "Bar artist", 1);
|
||||
crate::verify_artist!(file, tag, TagType::Id3v1, "Bar artist", 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -39,7 +39,7 @@ fn write() {
|
|||
set_artist!(tagged_file, primary_tag_mut, "Foo artist", 1 => file, "Bar artist");
|
||||
|
||||
// ID3v1
|
||||
set_artist!(tagged_file, tag_mut, TagType::ID3v1, "Bar artist", 1 => file, "Baz artist");
|
||||
set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Bar artist", 1 => file, "Baz artist");
|
||||
|
||||
// Now reread the file
|
||||
file.rewind().unwrap();
|
||||
|
@ -52,15 +52,15 @@ fn write() {
|
|||
|
||||
set_artist!(tagged_file, primary_tag_mut, "Bar artist", 1 => file, "Foo artist");
|
||||
|
||||
set_artist!(tagged_file, tag_mut, TagType::ID3v1, "Baz artist", 1 => file, "Bar artist");
|
||||
set_artist!(tagged_file, tag_mut, TagType::Id3v1, "Baz artist", 1 => file, "Bar artist");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_id3v1() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.wv", TagType::ID3v1);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.wv", TagType::Id3v1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_ape() {
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.wv", TagType::APE);
|
||||
crate::remove_tag!("tests/files/assets/minimal/full_test.wv", TagType::Ape);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use lofty::{ItemKey, Tag, TagType, TextEncoding};
|
|||
|
||||
#[test]
|
||||
fn tag_to_id3v2_lang_frame() {
|
||||
let mut tag = Tag::new(TagType::ID3v2);
|
||||
let mut tag = Tag::new(TagType::Id3v2);
|
||||
tag.insert_text(ItemKey::Lyrics, String::from("Test lyrics"));
|
||||
tag.insert_text(ItemKey::Comment, String::from("Test comment"));
|
||||
|
||||
|
|
Loading…
Reference in a new issue