From f76e9d8c861abb263b2891c25cf9d9b61b18ce15 Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Fri, 28 Apr 2023 01:55:40 -0400 Subject: [PATCH 1/5] ID3v2: Rename `ID3v2Tag` to `Id3v2Tag` --- benches/create_tag.rs | 4 +- examples/custom_resolver/src/main.rs | 6 +- src/aac/mod.rs | 4 +- src/ape/mod.rs | 4 +- src/ape/read.rs | 4 +- src/flac/mod.rs | 4 +- src/id3/v2/mod.rs | 4 +- src/id3/v2/read.rs | 8 +- src/id3/v2/tag.rs | 106 +++++++++++++-------------- src/id3/v2/write/mod.rs | 10 +-- src/iff/aiff/mod.rs | 4 +- src/iff/aiff/read.rs | 4 +- src/iff/chunk.rs | 4 +- src/iff/wav/mod.rs | 4 +- src/iff/wav/read.rs | 4 +- src/mpeg/mod.rs | 4 +- src/resolve.rs | 6 +- src/tag/mod.rs | 4 +- tests/files/ogg.rs | 4 +- tests/tags/conversions.rs | 4 +- 20 files changed, 98 insertions(+), 98 deletions(-) diff --git a/benches/create_tag.rs b/benches/create_tag.rs index 7b601b1b6..649b81716 100644 --- a/benches/create_tag.rs +++ b/benches/create_tag.rs @@ -1,6 +1,6 @@ use lofty::ape::ApeTag; use lofty::id3::v1::ID3v1Tag; -use lofty::id3::v2::ID3v2Tag; +use lofty::id3::v2::Id3v2Tag; use lofty::iff::aiff::AIFFTextChunks; use lofty::iff::wav::RIFFInfoList; use lofty::mp4::Ilst; @@ -36,7 +36,7 @@ fn bench_write(c: &mut Criterion) { [ ("AIFF Text Chunks", AIFFTextChunks), ("APEv2", ApeTag), - ("ID3v2", ID3v2Tag), + ("ID3v2", Id3v2Tag), ("ID3v1", ID3v1Tag), ("MP4 Ilst", Ilst), ("RIFF INFO", RIFFInfoList), diff --git a/examples/custom_resolver/src/main.rs b/examples/custom_resolver/src/main.rs index 69c7b6600..bec125206 100644 --- a/examples/custom_resolver/src/main.rs +++ b/examples/custom_resolver/src/main.rs @@ -1,6 +1,6 @@ use lofty::ape::ApeTag; use lofty::error::Result as LoftyResult; -use lofty::id3::v2::ID3v2Tag; +use lofty::id3::v2::Id3v2Tag; use lofty::resolve::FileResolver; use lofty::{FileProperties, FileType, ParseOptions, TagType}; use lofty_attr::LoftyFile; @@ -26,7 +26,7 @@ struct MyFile { // Specify a tag type #[lofty(tag_type = "Id3v2")] // Let's say our file *always* has an ID3v2Tag present. - pub id3v2_tag: ID3v2Tag, + pub id3v2_tag: Id3v2Tag, // Our APE tag is optional in this format, so we wrap it in an `Option` #[lofty(tag_type = "Ape")] @@ -45,7 +45,7 @@ impl MyFile { // Your parsing logic... Ok(Self { - id3v2_tag: ID3v2Tag::default(), + id3v2_tag: Id3v2Tag::default(), ape_tag: None, properties: FileProperties::default(), }) diff --git a/src/aac/mod.rs b/src/aac/mod.rs index f45216bb2..64be15fe7 100644 --- a/src/aac/mod.rs +++ b/src/aac/mod.rs @@ -7,7 +7,7 @@ mod properties; mod read; use crate::id3::v1::tag::ID3v1Tag; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use lofty_attr::LoftyFile; @@ -21,7 +21,7 @@ pub use properties::AACProperties; #[lofty(internal_write_module_do_not_use_anywhere_else)] pub struct AacFile { #[lofty(tag_type = "Id3v2")] - pub(crate) id3v2_tag: Option, + pub(crate) id3v2_tag: Option, #[lofty(tag_type = "Id3v1")] pub(crate) id3v1_tag: Option, pub(crate) properties: AACProperties, diff --git a/src/ape/mod.rs b/src/ape/mod.rs index a9de61787..8f582719c 100644 --- a/src/ape/mod.rs +++ b/src/ape/mod.rs @@ -12,7 +12,7 @@ mod read; pub(crate) mod tag; use crate::id3::v1::tag::ID3v1Tag; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use lofty_attr::LoftyFile; @@ -33,7 +33,7 @@ pub struct ApeFile { pub(crate) id3v1_tag: Option, /// An ID3v2 tag (Not officially supported) #[lofty(tag_type = "Id3v2")] - pub(crate) id3v2_tag: Option, + pub(crate) id3v2_tag: Option, /// An APEv1/v2 tag #[lofty(tag_type = "Ape")] pub(crate) ape_tag: Option, diff --git a/src/ape/read.rs b/src/ape/read.rs index 279c36e57..c634ed4a1 100644 --- a/src/ape/read.rs +++ b/src/ape/read.rs @@ -6,7 +6,7 @@ use super::{ApeFile, ApeProperties}; use crate::error::Result; use crate::id3::v1::tag::ID3v1Tag; use crate::id3::v2::read::parse_id3v2; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use crate::id3::{find_id3v1, find_id3v2, find_lyrics3v2, ID3FindResults}; use crate::macros::decode_err; use crate::probe::ParseOptions; @@ -24,7 +24,7 @@ where let mut stream_len = end - start; - let mut id3v2_tag: Option = None; + let mut id3v2_tag: Option = None; let mut id3v1_tag: Option = None; let mut ape_tag: Option = None; diff --git a/src/flac/mod.rs b/src/flac/mod.rs index c94f18294..500240eae 100644 --- a/src/flac/mod.rs +++ b/src/flac/mod.rs @@ -11,7 +11,7 @@ pub(crate) mod write; use crate::error::Result; use crate::file::{FileType, TaggedFile}; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use crate::ogg::tag::VorbisCommentsRef; use crate::ogg::{OggPictureStorage, VorbisComments}; use crate::picture::{Picture, PictureInformation}; @@ -44,7 +44,7 @@ pub use properties::FlacProperties; pub struct FlacFile { /// An ID3v2 tag #[lofty(tag_type = "Id3v2")] - pub(crate) id3v2_tag: Option, + pub(crate) id3v2_tag: Option, /// The vorbis comments contained in the file #[lofty(tag_type = "VorbisComments")] pub(crate) vorbis_comments_tag: Option, diff --git a/src/id3/v2/mod.rs b/src/id3/v2/mod.rs index 55e012d98..4dfd3cc22 100644 --- a/src/id3/v2/mod.rs +++ b/src/id3/v2/mod.rs @@ -4,7 +4,7 @@ //! //! See: //! -//! * [`ID3v2Tag`] +//! * [`Id3v2Tag`] //! * [Frame] mod flags; @@ -29,7 +29,7 @@ use byteorder::{BigEndian, ByteOrder, ReadBytesExt}; pub use flags::ID3v2TagFlags; pub use util::upgrade::{upgrade_v2, upgrade_v3}; -pub use tag::ID3v2Tag; +pub use tag::Id3v2Tag; pub use items::*; diff --git a/src/id3/v2/read.rs b/src/id3/v2/read.rs index a070beb7b..b0f553064 100644 --- a/src/id3/v2/read.rs +++ b/src/id3/v2/read.rs @@ -1,12 +1,12 @@ use super::frame::Frame; -use super::tag::ID3v2Tag; +use super::tag::Id3v2Tag; use super::ID3v2Header; use crate::error::Result; use crate::id3::v2::util::synchsafe::UnsynchronizedStream; use std::io::Read; -pub(crate) fn parse_id3v2(bytes: &mut R, header: ID3v2Header) -> Result +pub(crate) fn parse_id3v2(bytes: &mut R, header: ID3v2Header) -> Result where R: Read, { @@ -29,11 +29,11 @@ where Ok(ret) } -fn read_all_frames_into_tag(reader: &mut R, header: ID3v2Header) -> Result +fn read_all_frames_into_tag(reader: &mut R, header: ID3v2Header) -> Result where R: Read, { - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); tag.original_version = header.version; tag.set_flags(header.flags); diff --git a/src/id3/v2/tag.rs b/src/id3/v2/tag.rs index cb9ba073f..79fede344 100644 --- a/src/id3/v2/tag.rs +++ b/src/id3/v2/tag.rs @@ -98,13 +98,13 @@ macro_rules! impl_accessor { description = "An `ID3v2` tag", supported_formats(Aac, Aiff, Mpeg, Wav, read_only(Flac, Ape)) )] -pub struct ID3v2Tag { +pub struct Id3v2Tag { flags: ID3v2TagFlags, pub(super) original_version: ID3v2Version, pub(crate) frames: Vec>, } -impl IntoIterator for ID3v2Tag { +impl IntoIterator for Id3v2Tag { type Item = Frame<'static>; type IntoIter = std::vec::IntoIter; @@ -113,7 +113,7 @@ impl IntoIterator for ID3v2Tag { } } -impl<'a> IntoIterator for &'a ID3v2Tag { +impl<'a> IntoIterator for &'a Id3v2Tag { type Item = &'a Frame<'static>; type IntoIter = std::slice::Iter<'a, Frame<'static>>; @@ -122,7 +122,7 @@ impl<'a> IntoIterator for &'a ID3v2Tag { } } -impl Default for ID3v2Tag { +impl Default for Id3v2Tag { fn default() -> Self { Self { flags: ID3v2TagFlags::default(), @@ -132,16 +132,16 @@ impl Default for ID3v2Tag { } } -impl ID3v2Tag { +impl Id3v2Tag { /// Create a new empty `ID3v2Tag` /// /// # Examples /// /// ```rust - /// use lofty::id3::v2::ID3v2Tag; + /// use lofty::id3::v2::Id3v2Tag; /// use lofty::TagExt; /// - /// let id3v2_tag = ID3v2Tag::new(); + /// let id3v2_tag = Id3v2Tag::new(); /// assert!(id3v2_tag.is_empty()); /// ``` pub fn new() -> Self { @@ -167,7 +167,7 @@ impl ID3v2Tag { } } -impl ID3v2Tag { +impl Id3v2Tag { /// Gets a [`Frame`] from an id /// /// NOTE: This is *not* case-sensitive @@ -437,7 +437,7 @@ where } } -impl Accessor for ID3v2Tag { +impl Accessor for Id3v2Tag { impl_accessor!( title => "TIT2"; artist => "TPE1"; @@ -558,7 +558,7 @@ impl Accessor for ID3v2Tag { } } -impl TagExt for ID3v2Tag { +impl TagExt for Id3v2Tag { type Err = LoftyError; type RefKey<'a> = &'a FrameId<'a>; @@ -617,23 +617,23 @@ impl TagExt for ID3v2Tag { } #[derive(Debug, Clone, Default)] -pub struct SplitTagRemainder(ID3v2Tag); +pub struct SplitTagRemainder(Id3v2Tag); -impl From for ID3v2Tag { +impl From for Id3v2Tag { fn from(from: SplitTagRemainder) -> Self { from.0 } } impl Deref for SplitTagRemainder { - type Target = ID3v2Tag; + type Target = Id3v2Tag; fn deref(&self) -> &Self::Target { &self.0 } } -impl SplitTag for ID3v2Tag { +impl SplitTag for Id3v2Tag { type Remainder = SplitTagRemainder; fn split_tag(mut self) -> (Self::Remainder, Tag) { @@ -845,9 +845,9 @@ impl SplitTag for ID3v2Tag { } impl MergeTag for SplitTagRemainder { - type Merged = ID3v2Tag; + type Merged = Id3v2Tag; - fn merge_tag(self, mut tag: Tag) -> ID3v2Tag { + fn merge_tag(self, mut tag: Tag) -> Id3v2Tag { fn join_text_items<'a>( tag: &mut Tag, keys: impl IntoIterator, @@ -981,13 +981,13 @@ impl MergeTag for SplitTagRemainder { } } -impl From for Tag { - fn from(input: ID3v2Tag) -> Self { +impl From for Tag { + fn from(input: Id3v2Tag) -> Self { input.split_tag().1 } } -impl From for ID3v2Tag { +impl From for Id3v2Tag { fn from(input: Tag) -> Self { SplitTagRemainder::default().merge_tag(input) } @@ -1077,7 +1077,7 @@ mod tests { }; use crate::id3::v2::{ read_id3v2_header, AttachedPictureFrame, CommentFrame, ExtendedTextFrame, Frame, - FrameFlags, FrameId, FrameValue, ID3v2Tag, ID3v2Version, TextInformationFrame, + FrameFlags, FrameId, FrameValue, ID3v2Version, Id3v2Tag, TextInformationFrame, UrlLinkFrame, }; use crate::tag::utils::test_utils::read_path; @@ -1089,7 +1089,7 @@ mod tests { use super::{COMMENT_FRAME_ID, EMPTY_CONTENT_DESCRIPTOR}; - fn read_tag(path: &str) -> ID3v2Tag { + fn read_tag(path: &str) -> Id3v2Tag { let tag_bytes = crate::tag::utils::test_utils::read_path(path); let mut reader = std::io::Cursor::new(&tag_bytes[..]); @@ -1100,7 +1100,7 @@ mod tests { #[test] fn parse_id3v2() { - let mut expected_tag = ID3v2Tag::default(); + let mut expected_tag = Id3v2Tag::default(); let encoding = TextEncoding::Latin1; let flags = FrameFlags::default(); @@ -1254,7 +1254,7 @@ mod tests { counter: 65535, }; - let converted_tag: ID3v2Tag = tag.into(); + let converted_tag: Id3v2Tag = tag.into(); assert_eq!(converted_tag.frames.len(), 1); let actual_frame = converted_tag.frames.first().unwrap(); @@ -1274,7 +1274,7 @@ mod tests { #[test] fn fail_write_bad_frame() { - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); tag.insert(Frame { id: FrameId::Valid(Cow::Borrowed("ABCD")), value: FrameValue::Url(UrlLinkFrame(String::from("FOO URL"))), @@ -1294,7 +1294,7 @@ mod tests { #[test] fn tag_to_id3v2() { - fn verify_frame(tag: &ID3v2Tag, id: &str, value: &str) { + fn verify_frame(tag: &Id3v2Tag, id: &str, value: &str) { let frame = tag.get(id); assert!(frame.is_some()); @@ -1312,7 +1312,7 @@ mod tests { let tag = crate::tag::utils::test_utils::create_tag(TagType::Id3v2); - let id3v2_tag: ID3v2Tag = tag.into(); + let id3v2_tag: Id3v2Tag = tag.into(); verify_frame(&id3v2_tag, "TIT2", "Foo title"); verify_frame(&id3v2_tag, "TPE1", "Bar artist"); @@ -1334,8 +1334,8 @@ mod tests { } #[allow(clippy::field_reassign_with_default)] - fn create_full_test_tag(version: ID3v2Version) -> ID3v2Tag { - let mut tag = ID3v2Tag::default(); + fn create_full_test_tag(version: ID3v2Version) -> Id3v2Tag { + let mut tag = Id3v2Tag::default(); tag.original_version = version; let encoding = TextEncoding::UTF16; @@ -1518,7 +1518,7 @@ mod tests { #[test] fn multi_value_frame_to_tag() { use crate::traits::Accessor; - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); tag.set_artist(String::from("foo\0bar\0baz")); @@ -1545,7 +1545,7 @@ mod tests { ItemValue::Text(String::from("baz")), )); - let tag: ID3v2Tag = tag.into(); + let tag: Id3v2Tag = tag.into(); assert_eq!(tag.artist().as_deref(), Some("foo/bar/baz")) } @@ -1556,7 +1556,7 @@ mod tests { #[test] fn replaygain_tag_conversion() { - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); tag.insert( Frame::new( "TXXX", @@ -1639,7 +1639,7 @@ mod tests { )); assert_eq!(20, tag.len()); - let id3v2 = ID3v2Tag::from(tag.clone()); + let id3v2 = Id3v2Tag::from(tag.clone()); let (split_remainder, split_tag) = id3v2.split_tag(); assert_eq!(0, split_remainder.0.len()); @@ -1651,7 +1651,7 @@ mod tests { #[test] fn comments() { - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); let encoding = TextEncoding::Latin1; let flags = FrameFlags::default(); let custom_descriptor = "lofty-rs"; @@ -1720,7 +1720,7 @@ mod tests { ) .unwrap(); - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); tag.insert(txxx_frame.clone()); tag.insert(wxxx_frame.clone()); @@ -1743,7 +1743,7 @@ mod tests { .zip(tag.items()) .all(|(expected, actual)| expected == actual)); - let tag: ID3v2Tag = tag.into(); + let tag: Id3v2Tag = tag.into(); assert_eq!(tag.frames.len(), 2); assert_eq!(&tag.frames, &[txxx_frame, wxxx_frame]) @@ -1751,7 +1751,7 @@ mod tests { #[test] fn user_defined_frames_conversion() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); id3v2.insert( Frame::new( "TXXX", @@ -1805,7 +1805,7 @@ mod tests { #[test] fn set_track() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); let track = 1; id3v2.set_track(track); @@ -1816,7 +1816,7 @@ mod tests { #[test] fn set_track_total() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); let track_total = 2; id3v2.set_track_total(track_total); @@ -1827,7 +1827,7 @@ mod tests { #[test] fn set_track_and_track_total() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); let track = 1; let track_total = 2; @@ -1840,7 +1840,7 @@ mod tests { #[test] fn set_track_total_and_track() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); let track_total = 2; let track = 1; @@ -1853,7 +1853,7 @@ mod tests { #[test] fn set_disk() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); let disk = 1; id3v2.set_disk(disk); @@ -1864,7 +1864,7 @@ mod tests { #[test] fn set_disk_total() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); let disk_total = 2; id3v2.set_disk_total(disk_total); @@ -1875,7 +1875,7 @@ mod tests { #[test] fn set_disk_and_disk_total() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); let disk = 1; let disk_total = 2; @@ -1888,7 +1888,7 @@ mod tests { #[test] fn set_disk_total_and_disk() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); let disk_total = 2; let disk = 1; @@ -1911,7 +1911,7 @@ mod tests { ItemValue::Text(track_number.to_string()), )); - let tag: ID3v2Tag = tag.into(); + let tag: Id3v2Tag = tag.into(); assert_eq!(tag.track().unwrap(), track_number); assert!(tag.track_total().is_none()); @@ -1929,7 +1929,7 @@ mod tests { ItemValue::Text(track_total.to_string()), )); - let tag: ID3v2Tag = tag.into(); + let tag: Id3v2Tag = tag.into(); assert_eq!(tag.track().unwrap(), DEFAULT_NUMBER_IN_PAIR); assert_eq!(tag.track_total().unwrap(), track_total); @@ -1953,7 +1953,7 @@ mod tests { ItemValue::Text(track_total.to_string()), )); - let tag: ID3v2Tag = tag.into(); + let tag: Id3v2Tag = tag.into(); assert_eq!(tag.track().unwrap(), track_number); assert_eq!(tag.track_total().unwrap(), track_total); @@ -1971,7 +1971,7 @@ mod tests { ItemValue::Text(disk_number.to_string()), )); - let tag: ID3v2Tag = tag.into(); + let tag: Id3v2Tag = tag.into(); assert_eq!(tag.disk().unwrap(), disk_number); assert!(tag.disk_total().is_none()); @@ -1989,7 +1989,7 @@ mod tests { ItemValue::Text(disk_total.to_string()), )); - let tag: ID3v2Tag = tag.into(); + let tag: Id3v2Tag = tag.into(); assert_eq!(tag.disk().unwrap(), DEFAULT_NUMBER_IN_PAIR); assert_eq!(tag.disk_total().unwrap(), disk_total); @@ -2013,14 +2013,14 @@ mod tests { ItemValue::Text(disk_total.to_string()), )); - let tag: ID3v2Tag = tag.into(); + let tag: Id3v2Tag = tag.into(); assert_eq!(tag.disk().unwrap(), disk_number); assert_eq!(tag.disk_total().unwrap(), disk_total); } fn create_tag_with_trck_and_tpos_frame(content: &'static str) -> Tag { - fn insert_frame(id: &'static str, content: &'static str, tag: &mut ID3v2Tag) { + fn insert_frame(id: &'static str, content: &'static str, tag: &mut Id3v2Tag) { tag.insert(new_text_frame( FrameId::Valid(Cow::Borrowed(id)), content.to_string(), @@ -2028,7 +2028,7 @@ mod tests { )); } - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); insert_frame("TRCK", content, &mut tag); insert_frame("TPOS", content, &mut tag); @@ -2080,7 +2080,7 @@ mod tests { #[test] fn ufid_frame_with_musicbrainz_record_id() { - let mut id3v2 = ID3v2Tag::default(); + let mut id3v2 = Id3v2Tag::default(); let unknown_ufid_frame = UniqueFileIdentifierFrame { owner: "other".to_owned(), identifier: b"0123456789".to_vec(), diff --git a/src/id3/v2/write/mod.rs b/src/id3/v2/write/mod.rs index ef364dab9..f33d54600 100644 --- a/src/id3/v2/write/mod.rs +++ b/src/id3/v2/write/mod.rs @@ -8,7 +8,7 @@ use crate::id3::find_id3v2; use crate::id3::v2::frame::FrameRef; use crate::id3::v2::tag::Id3v2TagRef; use crate::id3::v2::util::synchsafe::SynchsafeInteger; -use crate::id3::v2::ID3v2Tag; +use crate::id3::v2::Id3v2Tag; use crate::macros::err; use crate::probe::Probe; @@ -49,13 +49,13 @@ pub(crate) fn write_id3v2<'a, I: Iterator> + Clone + 'a>( let file_type = file_type.unwrap(); - if !ID3v2Tag::SUPPORTED_FORMATS.contains(&file_type) { + if !Id3v2Tag::SUPPORTED_FORMATS.contains(&file_type) { err!(UnsupportedTag); } // Attempting to write a non-empty tag to a read only format // An empty tag implies the tag should be stripped. - if ID3v2Tag::READ_ONLY_FORMATS.contains(&file_type) { + if Id3v2Tag::READ_ONLY_FORMATS.contains(&file_type) { let mut peek = tag.frames.clone().peekable(); if peek.peek().is_some() { err!(UnsupportedTag); @@ -253,12 +253,12 @@ fn calculate_crc(content: &[u8]) -> [u8; 5] { #[cfg(test)] mod tests { - use crate::id3::v2::{ID3v2Tag, ID3v2TagFlags}; + use crate::id3::v2::{ID3v2TagFlags, Id3v2Tag}; use crate::{Accessor, TagExt}; #[test] fn id3v2_write_crc32() { - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); tag.set_artist(String::from("Foo artist")); let flags = ID3v2TagFlags { diff --git a/src/iff/aiff/mod.rs b/src/iff/aiff/mod.rs index 8e9f1833f..2665d7fee 100644 --- a/src/iff/aiff/mod.rs +++ b/src/iff/aiff/mod.rs @@ -4,7 +4,7 @@ mod properties; mod read; pub(crate) mod tag; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use crate::properties::FileProperties; use lofty_attr::LoftyFile; @@ -23,7 +23,7 @@ pub struct AiffFile { pub(crate) text_chunks_tag: Option, /// An ID3v2 tag #[lofty(tag_type = "Id3v2")] - pub(crate) id3v2_tag: Option, + pub(crate) id3v2_tag: Option, /// The file's audio properties pub(crate) properties: FileProperties, } diff --git a/src/iff/aiff/read.rs b/src/iff/aiff/read.rs index cfc87a0dc..cd0b6abfc 100644 --- a/src/iff/aiff/read.rs +++ b/src/iff/aiff/read.rs @@ -1,7 +1,7 @@ use super::tag::{AIFFTextChunks, Comment}; use super::AiffFile; use crate::error::Result; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use crate::iff::chunk::Chunks; use crate::macros::{decode_err, err}; use crate::probe::ParseOptions; @@ -45,7 +45,7 @@ where let mut annotations = Vec::new(); let mut comments = Vec::new(); - let mut id3v2_tag: Option = None; + let mut id3v2_tag: Option = None; let mut chunks = Chunks::::new(file_len); diff --git a/src/iff/chunk.rs b/src/iff/chunk.rs index 9f14a1d51..e8d9406aa 100644 --- a/src/iff/chunk.rs +++ b/src/iff/chunk.rs @@ -1,5 +1,5 @@ use crate::error::Result; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use crate::macros::{err, try_vec}; use std::io::{Read, Seek, SeekFrom}; @@ -91,7 +91,7 @@ impl Chunks { Ok(content) } - pub fn id3_chunk(&mut self, data: &mut R) -> Result + pub fn id3_chunk(&mut self, data: &mut R) -> Result where R: Read + Seek, { diff --git a/src/iff/wav/mod.rs b/src/iff/wav/mod.rs index 102b0f6b2..78a6e635f 100644 --- a/src/iff/wav/mod.rs +++ b/src/iff/wav/mod.rs @@ -4,7 +4,7 @@ mod properties; mod read; pub(crate) mod tag; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use lofty_attr::LoftyFile; @@ -22,7 +22,7 @@ pub struct WavFile { pub(crate) riff_info_tag: Option, /// An ID3v2 tag #[lofty(tag_type = "Id3v2")] - pub(crate) id3v2_tag: Option, + pub(crate) id3v2_tag: Option, /// The file's audio properties pub(crate) properties: WavProperties, } diff --git a/src/iff/wav/read.rs b/src/iff/wav/read.rs index 85938177c..34107f49e 100644 --- a/src/iff/wav/read.rs +++ b/src/iff/wav/read.rs @@ -2,7 +2,7 @@ use super::properties::WavProperties; use super::tag::RIFFInfoList; use super::WavFile; use crate::error::Result; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use crate::iff::chunk::Chunks; use crate::macros::decode_err; use crate::probe::ParseOptions; @@ -45,7 +45,7 @@ where let mut fmt = Vec::new(); let mut riff_info = RIFFInfoList::default(); - let mut id3v2_tag: Option = None; + let mut id3v2_tag: Option = None; let mut chunks = Chunks::::new(file_len); diff --git a/src/mpeg/mod.rs b/src/mpeg/mod.rs index 2e5beeccc..8f639e22a 100644 --- a/src/mpeg/mod.rs +++ b/src/mpeg/mod.rs @@ -9,7 +9,7 @@ pub use properties::MpegProperties; use crate::ape::tag::ApeTag; use crate::id3::v1::tag::ID3v1Tag; -use crate::id3::v2::tag::ID3v2Tag; +use crate::id3::v2::tag::Id3v2Tag; use lofty_attr::LoftyFile; @@ -20,7 +20,7 @@ use lofty_attr::LoftyFile; pub struct MpegFile { /// An ID3v2 tag #[lofty(tag_type = "Id3v2")] - pub(crate) id3v2_tag: Option, + pub(crate) id3v2_tag: Option, /// An ID3v1 tag #[lofty(tag_type = "Id3v1")] pub(crate) id3v1_tag: Option, diff --git a/src/resolve.rs b/src/resolve.rs index de2f1e566..3a5608d14 100644 --- a/src/resolve.rs +++ b/src/resolve.rs @@ -130,7 +130,7 @@ pub fn register_custom_resolver(name: &'static str) { #[cfg(test)] mod tests { use crate::file::{FileType, TaggedFileExt}; - use crate::id3::v2::ID3v2Tag; + use crate::id3::v2::Id3v2Tag; use crate::probe::ParseOptions; use crate::properties::FileProperties; use crate::resolve::{register_custom_resolver, FileResolver}; @@ -148,7 +148,7 @@ mod tests { #[lofty(file_type = "MyFile")] struct MyFile { #[lofty(tag_type = "Id3v2")] - id3v2_tag: Option, + id3v2_tag: Option, properties: FileProperties, } @@ -180,7 +180,7 @@ mod tests { _reader: &mut R, _parse_options: ParseOptions, ) -> crate::error::Result { - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); tag.set_artist(String::from("All is well!")); Ok(Self { diff --git a/src/tag/mod.rs b/src/tag/mod.rs index 3a567eb44..ee5019947 100644 --- a/src/tag/mod.rs +++ b/src/tag/mod.rs @@ -85,14 +85,14 @@ macro_rules! impl_accessor { /// Converting between formats /// /// ```rust -/// use lofty::id3::v2::ID3v2Tag; +/// use lofty::id3::v2::Id3v2Tag; /// use lofty::{Tag, TagType}; /// /// // 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 id3v2_tag: ID3v2Tag = tag.into(); +/// let id3v2_tag: Id3v2Tag = tag.into(); /// ``` #[derive(Clone)] pub struct Tag { diff --git a/tests/files/ogg.rs b/tests/files/ogg.rs index 05102be76..9f855d0e3 100644 --- a/tests/files/ogg.rs +++ b/tests/files/ogg.rs @@ -172,10 +172,10 @@ fn flac_remove_id3v2() { #[test] fn flac_try_write_non_empty_id3v2() { - use lofty::id3::v2::ID3v2Tag; + use lofty::id3::v2::Id3v2Tag; use lofty::Accessor; - let mut tag = ID3v2Tag::default(); + let mut tag = Id3v2Tag::default(); tag.set_artist(String::from("Foo artist")); assert!(tag diff --git a/tests/tags/conversions.rs b/tests/tags/conversions.rs index 5a1e411e5..3d3386f76 100644 --- a/tests/tags/conversions.rs +++ b/tests/tags/conversions.rs @@ -1,6 +1,6 @@ // Tests for special case conversions -use lofty::id3::v2::{CommentFrame, Frame, FrameFlags, ID3v2Tag, UnsynchronizedTextFrame}; +use lofty::id3::v2::{CommentFrame, Frame, FrameFlags, Id3v2Tag, UnsynchronizedTextFrame}; use lofty::{ItemKey, Tag, TagType, TextEncoding}; #[test] @@ -9,7 +9,7 @@ fn tag_to_id3v2_lang_frame() { tag.insert_text(ItemKey::Lyrics, String::from("Test lyrics")); tag.insert_text(ItemKey::Comment, String::from("Test comment")); - let id3: ID3v2Tag = tag.into(); + let id3: Id3v2Tag = tag.into(); assert_eq!( id3.get("USLT"), From 1bba4bfb9d0371131ae8ae75985bc84d9828cf21 Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Fri, 28 Apr 2023 01:58:19 -0400 Subject: [PATCH 2/5] ID3v2: Convert remaining types to UpperCamelCase --- src/error.rs | 2 +- src/id3/mod.rs | 4 +-- src/id3/v2/flags.rs | 2 +- src/id3/v2/frame/content.rs | 12 +++---- src/id3/v2/frame/mod.rs | 4 +-- src/id3/v2/frame/read.rs | 12 +++---- src/id3/v2/items/attached_picture_frame.rs | 12 +++---- src/id3/v2/items/extended_text_frame.rs | 4 +-- src/id3/v2/items/extended_url_frame.rs | 4 +-- src/id3/v2/items/language_frame.rs | 8 ++--- src/id3/v2/items/text_information_frame.rs | 4 +-- src/id3/v2/mod.rs | 30 ++++++++-------- src/id3/v2/read.rs | 6 ++-- src/id3/v2/tag.rs | 40 +++++++++++----------- src/id3/v2/write/mod.rs | 10 +++--- src/tag/utils.rs | 4 +-- tests/picture/format_parsers.rs | 10 +++--- 17 files changed, 84 insertions(+), 84 deletions(-) diff --git a/src/error.rs b/src/error.rs index c7cc886a0..7c35d73a2 100644 --- a/src/error.rs +++ b/src/error.rs @@ -94,7 +94,7 @@ pub enum Id3v2ErrorKind { InvalidUnsynchronisation, /// Arises when a text encoding other than Latin-1 or UTF-16 appear in an ID3v2.2 tag V2InvalidTextEncoding, - /// Arises when an invalid picture format is parsed. Only applicable to [`ID3v2Version::V2`](crate::id3::v2::ID3v2Version::V2) + /// Arises when an invalid picture format is parsed. Only applicable to [`ID3v2Version::V2`](crate::id3::v2::Id3v2Version::V2) BadPictureFormat(String), /// Arises when invalid data is encountered while reading an ID3v2 synchronized text frame BadSyncText, diff --git a/src/id3/mod.rs b/src/id3/mod.rs index 4e879fefe..b87bc2b5a 100644 --- a/src/id3/mod.rs +++ b/src/id3/mod.rs @@ -8,7 +8,7 @@ pub mod v2; use crate::error::{ErrorKind, LoftyError, Result}; use crate::macros::try_vec; -use v2::{read_id3v2_header, ID3v2Header}; +use v2::{read_id3v2_header, Id3v2Header}; use std::io::{Read, Seek, SeekFrom}; use std::ops::Neg; @@ -85,7 +85,7 @@ where pub(crate) fn find_id3v2( data: &mut R, read: bool, -) -> Result>>> +) -> Result>>> where R: Read + Seek, { diff --git a/src/id3/v2/flags.rs b/src/id3/v2/flags.rs index 277d25bfe..e86f3832c 100644 --- a/src/id3/v2/flags.rs +++ b/src/id3/v2/flags.rs @@ -3,7 +3,7 @@ use super::restrictions::TagRestrictions; /// Flags that apply to the entire tag #[derive(Default, Copy, Clone, Debug, PartialEq, Eq)] #[allow(clippy::struct_excessive_bools)] -pub struct ID3v2TagFlags { +pub struct Id3v2TagFlags { /// Whether or not all frames are unsynchronised. See [`FrameFlags::unsynchronisation`](crate::id3::v2::FrameFlags::unsynchronisation) pub unsynchronisation: bool, /// Indicates if the tag is in an experimental stage diff --git a/src/id3/v2/frame/content.rs b/src/id3/v2/frame/content.rs index 0ed91c17d..aa4f8ba0a 100644 --- a/src/id3/v2/frame/content.rs +++ b/src/id3/v2/frame/content.rs @@ -4,7 +4,7 @@ use crate::id3::v2::items::{ AttachedPictureFrame, CommentFrame, ExtendedTextFrame, ExtendedUrlFrame, Popularimeter, TextInformationFrame, UniqueFileIdentifierFrame, UnsynchronizedTextFrame, UrlLinkFrame, }; -use crate::id3::v2::ID3v2Version; +use crate::id3::v2::Id3v2Version; use crate::macros::err; use crate::util::text::TextEncoding; @@ -12,9 +12,9 @@ use std::io::Read; #[rustfmt::skip] pub(super) fn parse_content( - reader: &mut R, - id: &str, - version: ID3v2Version, + reader: &mut R, + id: &str, + version: Id3v2Version, ) -> Result> { Ok(match id { // The ID was previously upgraded, but the content remains unchanged, so version is necessary @@ -45,9 +45,9 @@ pub(super) fn parse_content( pub(in crate::id3::v2) fn verify_encoding( encoding: u8, - version: ID3v2Version, + version: Id3v2Version, ) -> Result { - if version == ID3v2Version::V2 && (encoding != 0 && encoding != 1) { + if version == Id3v2Version::V2 && (encoding != 0 && encoding != 1) { return Err(Id3v2Error::new(Id3v2ErrorKind::V2InvalidTextEncoding).into()); } diff --git a/src/id3/v2/frame/mod.rs b/src/id3/v2/frame/mod.rs index 38a9b0992..af63954f9 100644 --- a/src/id3/v2/frame/mod.rs +++ b/src/id3/v2/frame/mod.rs @@ -8,7 +8,7 @@ use super::items::{ TextInformationFrame, UniqueFileIdentifierFrame, UnsynchronizedTextFrame, UrlLinkFrame, }; use super::util::upgrade::{upgrade_v2, upgrade_v3}; -use super::ID3v2Version; +use super::Id3v2Version; use crate::error::{ErrorKind, Id3v2Error, Id3v2ErrorKind, LoftyError, Result}; use crate::tag::item::{ItemKey, ItemValue, TagItem}; use crate::tag::TagType; @@ -272,7 +272,7 @@ impl FrameValue { FrameValue::UserText(content) => content.as_bytes(), FrameValue::UserUrl(content) => content.as_bytes(), FrameValue::Url(link) => link.as_bytes(), - FrameValue::Picture(attached_picture) => attached_picture.as_bytes(ID3v2Version::V4)?, + FrameValue::Picture(attached_picture) => attached_picture.as_bytes(Id3v2Version::V4)?, FrameValue::Popularimeter(popularimeter) => popularimeter.as_bytes(), FrameValue::Binary(binary) => binary.clone(), FrameValue::UniqueFileIdentifier(frame) => frame.as_bytes(), diff --git a/src/id3/v2/frame/read.rs b/src/id3/v2/frame/read.rs index 781928a61..637d0696d 100644 --- a/src/id3/v2/frame/read.rs +++ b/src/id3/v2/frame/read.rs @@ -3,7 +3,7 @@ use super::Frame; use crate::error::{Id3v2Error, Id3v2ErrorKind, Result}; use crate::id3::v2::frame::content::parse_content; use crate::id3::v2::util::synchsafe::{SynchsafeInteger, UnsynchronizedStream}; -use crate::id3::v2::{FrameFlags, FrameId, FrameValue, ID3v2Version}; +use crate::id3::v2::{FrameFlags, FrameId, FrameValue, Id3v2Version}; use crate::macros::try_vec; use std::io::Read; @@ -11,15 +11,15 @@ use std::io::Read; use byteorder::{BigEndian, ReadBytesExt}; impl<'a> Frame<'a> { - pub(crate) fn read(reader: &mut R, version: ID3v2Version) -> Result<(Option, bool)> + pub(crate) fn read(reader: &mut R, version: Id3v2Version) -> Result<(Option, bool)> where R: Read, { // The header will be upgraded to ID3v2.4 past this point, so they can all be treated the same let (id, mut size, mut flags) = match match version { - ID3v2Version::V2 => parse_v2_header(reader)?, - ID3v2Version::V3 => parse_header(reader, false)?, - ID3v2Version::V4 => parse_header(reader, true)?, + Id3v2Version::V2 => parse_v2_header(reader)?, + Id3v2Version::V3 => parse_header(reader, false)?, + Id3v2Version::V4 => parse_header(reader, true)?, } { None => return Ok((None, true)), Some(frame_header) => frame_header, @@ -170,7 +170,7 @@ fn parse_frame( reader: &mut R, id: FrameId<'static>, flags: FrameFlags, - version: ID3v2Version, + version: Id3v2Version, ) -> Result<(Option>, bool)> { match parse_content(reader, id.as_str(), version)? { Some(value) => Ok((Some(Frame { id, value, flags }), false)), diff --git a/src/id3/v2/items/attached_picture_frame.rs b/src/id3/v2/items/attached_picture_frame.rs index 7386e6a5a..8f690f010 100644 --- a/src/id3/v2/items/attached_picture_frame.rs +++ b/src/id3/v2/items/attached_picture_frame.rs @@ -1,5 +1,5 @@ use crate::error::{Id3v2Error, Id3v2ErrorKind, Result}; -use crate::id3::v2::ID3v2Version; +use crate::id3::v2::Id3v2Version; use crate::macros::err; use crate::picture::{MimeType, Picture, PictureType}; use crate::util::text::{encode_text, TextEncoding}; @@ -33,7 +33,7 @@ impl AttachedPictureFrame { /// ID3v2.2: /// /// * The format is not "PNG" or "JPG" - pub fn parse(reader: &mut R, version: ID3v2Version) -> Result + pub fn parse(reader: &mut R, version: Id3v2Version) -> Result where R: Read, { @@ -42,7 +42,7 @@ impl AttachedPictureFrame { None => err!(NotAPicture), }; - let mime_type = if version == ID3v2Version::V2 { + let mime_type = if version == Id3v2Version::V2 { let mut format = [0; 3]; reader.read_exact(&mut format)?; @@ -91,16 +91,16 @@ impl AttachedPictureFrame { /// ID3v2.2: /// /// * The mimetype is not [`MimeType::Png`] or [`MimeType::Jpeg`] - pub fn as_bytes(&self, version: ID3v2Version) -> Result> { + pub fn as_bytes(&self, version: Id3v2Version) -> Result> { let mut data = vec![self.encoding as u8]; let max_size = match version { // ID3v2.2 uses a 24-bit number for sizes - ID3v2Version::V2 => 0xFFFF_FF16_u64, + Id3v2Version::V2 => 0xFFFF_FF16_u64, _ => u64::from(u32::MAX), }; - if version == ID3v2Version::V2 { + if version == Id3v2Version::V2 { // ID3v2.2 PIC is pretty limited with formats let format = match self.picture.mime_type { MimeType::Png => "PNG", diff --git a/src/id3/v2/items/extended_text_frame.rs b/src/id3/v2/items/extended_text_frame.rs index 01c7e3386..87188c406 100644 --- a/src/id3/v2/items/extended_text_frame.rs +++ b/src/id3/v2/items/extended_text_frame.rs @@ -1,6 +1,6 @@ use crate::error::{Id3v2Error, Id3v2ErrorKind, LoftyError, Result}; use crate::id3::v2::frame::content::verify_encoding; -use crate::id3::v2::ID3v2Version; +use crate::id3::v2::Id3v2Version; use crate::util::text::{decode_text, encode_text, read_to_terminator, utf16_decode, TextEncoding}; use std::hash::{Hash, Hasher}; @@ -48,7 +48,7 @@ impl ExtendedTextFrame { /// ID3v2.2: /// /// * The encoding is not [`TextEncoding::Latin1`] or [`TextEncoding::UTF16`] - pub fn parse(reader: &mut R, version: ID3v2Version) -> Result> + pub fn parse(reader: &mut R, version: Id3v2Version) -> Result> where R: Read, { diff --git a/src/id3/v2/items/extended_url_frame.rs b/src/id3/v2/items/extended_url_frame.rs index a82f1917e..5dff89154 100644 --- a/src/id3/v2/items/extended_url_frame.rs +++ b/src/id3/v2/items/extended_url_frame.rs @@ -1,6 +1,6 @@ use crate::error::Result; use crate::id3::v2::frame::content::verify_encoding; -use crate::id3::v2::ID3v2Version; +use crate::id3::v2::Id3v2Version; use crate::util::text::{decode_text, encode_text, TextEncoding}; use std::hash::{Hash, Hasher}; @@ -48,7 +48,7 @@ impl ExtendedUrlFrame { /// ID3v2.2: /// /// * The encoding is not [`TextEncoding::Latin1`] or [`TextEncoding::UTF16`] - pub fn parse(reader: &mut R, version: ID3v2Version) -> Result> + pub fn parse(reader: &mut R, version: Id3v2Version) -> Result> where R: Read, { diff --git a/src/id3/v2/items/language_frame.rs b/src/id3/v2/items/language_frame.rs index c7fab9eed..33e5f0820 100644 --- a/src/id3/v2/items/language_frame.rs +++ b/src/id3/v2/items/language_frame.rs @@ -1,6 +1,6 @@ use crate::error::{Id3v2Error, Id3v2ErrorKind, Result}; use crate::id3::v2::frame::content::verify_encoding; -use crate::id3::v2::ID3v2Version; +use crate::id3::v2::Id3v2Version; use crate::util::text::{decode_text, encode_text, TextEncoding}; use std::hash::{Hash, Hasher}; @@ -19,7 +19,7 @@ struct LanguageFrame { } impl LanguageFrame { - fn parse(reader: &mut R, version: ID3v2Version) -> Result> + fn parse(reader: &mut R, version: Id3v2Version) -> Result> where R: Read, { @@ -113,7 +113,7 @@ impl CommentFrame { /// ID3v2.2: /// /// * The encoding is not [`TextEncoding::Latin1`] or [`TextEncoding::UTF16`] - pub fn parse(reader: &mut R, version: ID3v2Version) -> Result> + pub fn parse(reader: &mut R, version: Id3v2Version) -> Result> where R: Read, { @@ -188,7 +188,7 @@ impl UnsynchronizedTextFrame { /// ID3v2.2: /// /// * The encoding is not [`TextEncoding::Latin1`] or [`TextEncoding::UTF16`] - pub fn parse(reader: &mut R, version: ID3v2Version) -> Result> + pub fn parse(reader: &mut R, version: Id3v2Version) -> Result> where R: Read, { diff --git a/src/id3/v2/items/text_information_frame.rs b/src/id3/v2/items/text_information_frame.rs index abd93a428..6209c31ed 100644 --- a/src/id3/v2/items/text_information_frame.rs +++ b/src/id3/v2/items/text_information_frame.rs @@ -1,6 +1,6 @@ use crate::error::Result; use crate::id3::v2::frame::content::verify_encoding; -use crate::id3::v2::ID3v2Version; +use crate::id3::v2::Id3v2Version; use crate::util::text::{decode_text, encode_text, TextEncoding}; use byteorder::ReadBytesExt; @@ -28,7 +28,7 @@ impl TextInformationFrame { /// ID3v2.2: /// /// * The encoding is not [`TextEncoding::Latin1`] or [`TextEncoding::UTF16`] - pub fn parse(reader: &mut R, version: ID3v2Version) -> Result> + pub fn parse(reader: &mut R, version: Id3v2Version) -> Result> where R: Read, { diff --git a/src/id3/v2/mod.rs b/src/id3/v2/mod.rs index 4dfd3cc22..663a79c41 100644 --- a/src/id3/v2/mod.rs +++ b/src/id3/v2/mod.rs @@ -26,7 +26,7 @@ use byteorder::{BigEndian, ByteOrder, ReadBytesExt}; // Exports -pub use flags::ID3v2TagFlags; +pub use flags::Id3v2TagFlags; pub use util::upgrade::{upgrade_v2, upgrade_v3}; pub use tag::Id3v2Tag; @@ -42,7 +42,7 @@ pub use restrictions::{ /// The ID3v2 version #[derive(PartialEq, Eq, Debug, Clone, Copy)] -pub enum ID3v2Version { +pub enum Id3v2Version { /// ID3v2.2 V2, /// ID3v2.3 @@ -52,14 +52,14 @@ pub enum ID3v2Version { } #[derive(Copy, Clone, Debug)] -pub(crate) struct ID3v2Header { - pub version: ID3v2Version, - pub flags: ID3v2TagFlags, +pub(crate) struct Id3v2Header { + pub version: Id3v2Version, + pub flags: Id3v2TagFlags, pub size: u32, pub extended_size: u32, } -pub(crate) fn read_id3v2_header(bytes: &mut R) -> Result +pub(crate) fn read_id3v2_header(bytes: &mut R) -> Result where R: Read, { @@ -72,9 +72,9 @@ where // Version is stored as [major, minor], but here we don't care about minor revisions unless there's an error. let version = match header[3] { - 2 => ID3v2Version::V2, - 3 => ID3v2Version::V3, - 4 => ID3v2Version::V4, + 2 => Id3v2Version::V2, + 3 => Id3v2Version::V3, + 4 => Id3v2Version::V4, major => { return Err(Id3v2Error::new(Id3v2ErrorKind::BadId3v2Version(major, header[4])).into()) }, @@ -85,15 +85,15 @@ where // Compression was a flag only used in ID3v2.2 (bit 2). // At the time the ID3v2.2 specification was written, a compression scheme wasn't decided. // The spec recommends just ignoring the tag in this case. - if version == ID3v2Version::V2 && flags & 0x40 == 0x40 { + if version == Id3v2Version::V2 && flags & 0x40 == 0x40 { return Err(Id3v2Error::new(Id3v2ErrorKind::V2Compression).into()); } - let mut flags_parsed = ID3v2TagFlags { + let mut flags_parsed = Id3v2TagFlags { unsynchronisation: flags & 0x80 == 0x80, - experimental: (version == ID3v2Version::V4 || version == ID3v2Version::V3) + experimental: (version == Id3v2Version::V4 || version == Id3v2Version::V3) && flags & 0x20 == 0x20, - footer: (version == ID3v2Version::V4 || version == ID3v2Version::V3) + footer: (version == Id3v2Version::V4 || version == Id3v2Version::V3) && flags & 0x10 == 0x10, crc: false, // Retrieved later if applicable restrictions: None, // Retrieved later if applicable @@ -103,7 +103,7 @@ where let mut extended_size = 0; let extended_header = - (version == ID3v2Version::V4 || version == ID3v2Version::V3) && flags & 0x40 == 0x40; + (version == Id3v2Version::V4 || version == Id3v2Version::V3) && flags & 0x40 == 0x40; if extended_header { extended_size = bytes.read_u32::()?.unsynch(); @@ -139,7 +139,7 @@ where return Err(Id3v2Error::new(Id3v2ErrorKind::BadExtendedHeaderSize).into()); } - Ok(ID3v2Header { + Ok(Id3v2Header { version, flags: flags_parsed, size, diff --git a/src/id3/v2/read.rs b/src/id3/v2/read.rs index b0f553064..2bc816985 100644 --- a/src/id3/v2/read.rs +++ b/src/id3/v2/read.rs @@ -1,12 +1,12 @@ use super::frame::Frame; use super::tag::Id3v2Tag; -use super::ID3v2Header; +use super::Id3v2Header; use crate::error::Result; use crate::id3::v2::util::synchsafe::UnsynchronizedStream; use std::io::Read; -pub(crate) fn parse_id3v2(bytes: &mut R, header: ID3v2Header) -> Result +pub(crate) fn parse_id3v2(bytes: &mut R, header: Id3v2Header) -> Result where R: Read, { @@ -29,7 +29,7 @@ where Ok(ret) } -fn read_all_frames_into_tag(reader: &mut R, header: ID3v2Header) -> Result +fn read_all_frames_into_tag(reader: &mut R, header: Id3v2Header) -> Result where R: Read, { diff --git a/src/id3/v2/tag.rs b/src/id3/v2/tag.rs index 79fede344..c62078be8 100644 --- a/src/id3/v2/tag.rs +++ b/src/id3/v2/tag.rs @@ -1,7 +1,7 @@ -use super::flags::ID3v2TagFlags; +use super::flags::Id3v2TagFlags; use super::frame::id::FrameId; use super::frame::{Frame, FrameFlags, FrameValue, EMPTY_CONTENT_DESCRIPTOR, UNKNOWN_LANGUAGE}; -use super::ID3v2Version; +use super::Id3v2Version; use crate::error::{LoftyError, Result}; use crate::id3::v2::frame::{FrameRef, MUSICBRAINZ_UFID_OWNER}; use crate::id3::v2::items::{ @@ -99,8 +99,8 @@ macro_rules! impl_accessor { supported_formats(Aac, Aiff, Mpeg, Wav, read_only(Flac, Ape)) )] pub struct Id3v2Tag { - flags: ID3v2TagFlags, - pub(super) original_version: ID3v2Version, + flags: Id3v2TagFlags, + pub(super) original_version: Id3v2Version, pub(crate) frames: Vec>, } @@ -125,8 +125,8 @@ impl<'a> IntoIterator for &'a Id3v2Tag { impl Default for Id3v2Tag { fn default() -> Self { Self { - flags: ID3v2TagFlags::default(), - original_version: ID3v2Version::V4, + flags: Id3v2TagFlags::default(), + original_version: Id3v2Version::V4, frames: Vec::new(), } } @@ -148,13 +148,13 @@ impl Id3v2Tag { Self::default() } - /// Returns the [`ID3v2TagFlags`] - pub fn flags(&self) -> &ID3v2TagFlags { + /// Returns the [`Id3v2TagFlags`] + pub fn flags(&self) -> &Id3v2TagFlags { &self.flags } /// Restrict the tag's flags - pub fn set_flags(&mut self, flags: ID3v2TagFlags) { + pub fn set_flags(&mut self, flags: Id3v2TagFlags) { self.flags = flags } @@ -162,7 +162,7 @@ impl Id3v2Tag { /// /// This is here, since the tag is upgraded to `ID3v2.4`, but a `v2.2` or `v2.3` /// tag may have been read. - pub fn original_version(&self) -> ID3v2Version { + pub fn original_version(&self) -> Id3v2Version { self.original_version } } @@ -179,7 +179,7 @@ impl Id3v2Tag { /// Gets the text for a frame /// - /// If the tag is [`ID3v2Version::V4`], this will allocate if the text contains any + /// If the tag is [`Id3v2Version::V4`], this will allocate if the text contains any /// null (`'\0'`) text separators to replace them with a slash (`'/'`). pub fn get_text(&self, id: &str) -> Option> { let frame = self.get(id); @@ -189,7 +189,7 @@ impl Id3v2Tag { }) = frame { if !value.contains(V4_MULTI_VALUE_SEPARATOR) - || self.original_version != ID3v2Version::V4 + || self.original_version != Id3v2Version::V4 { return Some(Cow::Borrowed(value.as_str())); } @@ -994,14 +994,14 @@ impl From for Id3v2Tag { } pub(crate) struct Id3v2TagRef<'a, I: Iterator> + 'a> { - pub(crate) flags: ID3v2TagFlags, + pub(crate) flags: Id3v2TagFlags, pub(crate) frames: I, } impl<'a> Id3v2TagRef<'a, std::iter::Empty>> { pub(crate) fn empty() -> Self { Self { - flags: ID3v2TagFlags::default(), + flags: Id3v2TagFlags::default(), frames: std::iter::empty(), } } @@ -1077,7 +1077,7 @@ mod tests { }; use crate::id3::v2::{ read_id3v2_header, AttachedPictureFrame, CommentFrame, ExtendedTextFrame, Frame, - FrameFlags, FrameId, FrameValue, ID3v2Version, Id3v2Tag, TextInformationFrame, + FrameFlags, FrameId, FrameValue, Id3v2Tag, Id3v2Version, TextInformationFrame, UrlLinkFrame, }; use crate::tag::utils::test_utils::read_path; @@ -1334,7 +1334,7 @@ mod tests { } #[allow(clippy::field_reassign_with_default)] - fn create_full_test_tag(version: ID3v2Version) -> Id3v2Tag { + fn create_full_test_tag(version: Id3v2Version) -> Id3v2Tag { let mut tag = Id3v2Tag::default(); tag.original_version = version; @@ -1423,7 +1423,7 @@ mod tests { #[test] fn id3v24_full() { - let tag = create_full_test_tag(ID3v2Version::V4); + let tag = create_full_test_tag(Id3v2Version::V4); let parsed_tag = read_tag("tests/tags/assets/id3v2/test_full.id3v24"); assert_eq!(tag, parsed_tag); @@ -1431,7 +1431,7 @@ mod tests { #[test] fn id3v23_full() { - let tag = create_full_test_tag(ID3v2Version::V3); + let tag = create_full_test_tag(Id3v2Version::V3); let parsed_tag = read_tag("tests/tags/assets/id3v2/test_full.id3v23"); assert_eq!(tag, parsed_tag); @@ -1439,7 +1439,7 @@ mod tests { #[test] fn id3v22_full() { - let tag = create_full_test_tag(ID3v2Version::V2); + let tag = create_full_test_tag(Id3v2Version::V2); let parsed_tag = read_tag("tests/tags/assets/id3v2/test_full.id3v22"); assert_eq!(tag, parsed_tag); @@ -1447,7 +1447,7 @@ mod tests { #[test] fn id3v24_footer() { - let mut tag = create_full_test_tag(ID3v2Version::V4); + let mut tag = create_full_test_tag(Id3v2Version::V4); tag.flags.footer = true; let mut writer = Vec::new(); diff --git a/src/id3/v2/write/mod.rs b/src/id3/v2/write/mod.rs index f33d54600..472ef3dec 100644 --- a/src/id3/v2/write/mod.rs +++ b/src/id3/v2/write/mod.rs @@ -1,7 +1,7 @@ mod chunk_file; mod frame; -use super::ID3v2TagFlags; +use super::Id3v2TagFlags; use crate::error::Result; use crate::file::FileType; use crate::id3::find_id3v2; @@ -157,7 +157,7 @@ pub(super) fn create_tag<'a, I: Iterator> + 'a>( Ok(id3v2.into_inner()) } -fn create_tag_header(flags: ID3v2TagFlags) -> Result<(Cursor>, u32)> { +fn create_tag_header(flags: Id3v2TagFlags) -> Result<(Cursor>, u32)> { let mut header = Cursor::new(Vec::new()); header.write_all(&[b'I', b'D', b'3'])?; @@ -253,7 +253,7 @@ fn calculate_crc(content: &[u8]) -> [u8; 5] { #[cfg(test)] mod tests { - use crate::id3::v2::{ID3v2TagFlags, Id3v2Tag}; + use crate::id3::v2::{Id3v2Tag, Id3v2TagFlags}; use crate::{Accessor, TagExt}; #[test] @@ -261,9 +261,9 @@ mod tests { let mut tag = Id3v2Tag::default(); tag.set_artist(String::from("Foo artist")); - let flags = ID3v2TagFlags { + let flags = Id3v2TagFlags { crc: true, - ..ID3v2TagFlags::default() + ..Id3v2TagFlags::default() }; tag.set_flags(flags); diff --git a/src/tag/utils.rs b/src/tag/utils.rs index b142e3a40..ac347f995 100644 --- a/src/tag/utils.rs +++ b/src/tag/utils.rs @@ -6,7 +6,7 @@ use crate::{aac, ape, flac, iff, mpeg, wavpack}; use crate::id3::v1::tag::Id3v1TagRef; use crate::id3::v2::tag::Id3v2TagRef; -use crate::id3::v2::{self, ID3v2TagFlags}; +use crate::id3::v2::{self, Id3v2TagFlags}; use crate::mp4::Ilst; use crate::ogg::tag::{create_vorbis_comments_ref, VorbisCommentsRef}; use ape::tag::ApeTagRef; @@ -46,7 +46,7 @@ pub(crate) fn dump_tag(tag: &Tag, writer: &mut W) -> Result<()> { .dump_to(writer), TagType::Id3v1 => Into::>::into(tag).dump_to(writer), TagType::Id3v2 => Id3v2TagRef { - flags: ID3v2TagFlags::default(), + flags: Id3v2TagFlags::default(), frames: v2::tag::tag_frames(tag), } .dump_to(writer), diff --git a/tests/picture/format_parsers.rs b/tests/picture/format_parsers.rs index 7500f8285..dc19540bd 100644 --- a/tests/picture/format_parsers.rs +++ b/tests/picture/format_parsers.rs @@ -1,4 +1,4 @@ -use lofty::id3::v2::{AttachedPictureFrame, ID3v2Version}; +use lofty::id3::v2::{AttachedPictureFrame, Id3v2Version}; use lofty::{Picture, PictureInformation, PictureType, TextEncoding}; use std::fs::File; @@ -28,7 +28,7 @@ fn create_original_picture() -> Picture { fn id3v24_apic() { let buf = get_buf("tests/picture/assets/png_640x628.apic"); - let apic = AttachedPictureFrame::parse(&mut &buf[..], ID3v2Version::V4).unwrap(); + let apic = AttachedPictureFrame::parse(&mut &buf[..], Id3v2Version::V4).unwrap(); assert_eq!(create_original_picture(), apic.picture); } @@ -43,7 +43,7 @@ fn as_apic_bytes() { picture: original_picture, }; - let original_as_apic = apic.as_bytes(ID3v2Version::V4).unwrap(); + let original_as_apic = apic.as_bytes(Id3v2Version::V4).unwrap(); assert_eq!(buf, original_as_apic); } @@ -52,7 +52,7 @@ fn as_apic_bytes() { fn id3v22_pic() { let buf = get_buf("tests/picture/assets/png_640x628.pic"); - let pic = AttachedPictureFrame::parse(&mut &buf[..], ID3v2Version::V2).unwrap(); + let pic = AttachedPictureFrame::parse(&mut &buf[..], Id3v2Version::V2).unwrap(); assert_eq!(create_original_picture(), pic.picture); } @@ -67,7 +67,7 @@ fn as_apic_bytes_v2() { picture: original_picture, }; - let original_as_pic = pic.as_bytes(ID3v2Version::V2).unwrap(); + let original_as_pic = pic.as_bytes(Id3v2Version::V2).unwrap(); assert_eq!(buf, original_as_pic); } From 236722699190f4d7669178d66cf28ecc71f7c100 Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Fri, 28 Apr 2023 02:00:01 -0400 Subject: [PATCH 3/5] ID3v1: Rename `ID3v1Tag` to `Id3v1Tag` --- benches/create_tag.rs | 4 ++-- src/aac/mod.rs | 4 ++-- src/ape/mod.rs | 4 ++-- src/ape/read.rs | 4 ++-- src/id3/mod.rs | 2 +- src/id3/v1/mod.rs | 4 ++-- src/id3/v1/read.rs | 6 +++--- src/id3/v1/tag.rs | 30 +++++++++++++++--------------- src/id3/v1/write.rs | 2 +- src/mpeg/mod.rs | 4 ++-- src/wavpack/mod.rs | 4 ++-- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/benches/create_tag.rs b/benches/create_tag.rs index 649b81716..a37fb0910 100644 --- a/benches/create_tag.rs +++ b/benches/create_tag.rs @@ -1,5 +1,5 @@ use lofty::ape::ApeTag; -use lofty::id3::v1::ID3v1Tag; +use lofty::id3::v1::Id3v1Tag; use lofty::id3::v2::Id3v2Tag; use lofty::iff::aiff::AIFFTextChunks; use lofty::iff::wav::RIFFInfoList; @@ -37,7 +37,7 @@ fn bench_write(c: &mut Criterion) { ("AIFF Text Chunks", AIFFTextChunks), ("APEv2", ApeTag), ("ID3v2", Id3v2Tag), - ("ID3v1", ID3v1Tag), + ("ID3v1", Id3v1Tag), ("MP4 Ilst", Ilst), ("RIFF INFO", RIFFInfoList), ("Vorbis Comments", VorbisComments), diff --git a/src/aac/mod.rs b/src/aac/mod.rs index 64be15fe7..46b2b91c8 100644 --- a/src/aac/mod.rs +++ b/src/aac/mod.rs @@ -6,7 +6,7 @@ mod header; mod properties; mod read; -use crate::id3::v1::tag::ID3v1Tag; +use crate::id3::v1::tag::Id3v1Tag; use crate::id3::v2::tag::Id3v2Tag; use lofty_attr::LoftyFile; @@ -23,6 +23,6 @@ pub struct AacFile { #[lofty(tag_type = "Id3v2")] pub(crate) id3v2_tag: Option, #[lofty(tag_type = "Id3v1")] - pub(crate) id3v1_tag: Option, + pub(crate) id3v1_tag: Option, pub(crate) properties: AACProperties, } diff --git a/src/ape/mod.rs b/src/ape/mod.rs index 8f582719c..629423043 100644 --- a/src/ape/mod.rs +++ b/src/ape/mod.rs @@ -11,7 +11,7 @@ mod properties; mod read; pub(crate) mod tag; -use crate::id3::v1::tag::ID3v1Tag; +use crate::id3::v1::tag::Id3v1Tag; use crate::id3::v2::tag::Id3v2Tag; use lofty_attr::LoftyFile; @@ -30,7 +30,7 @@ pub use tag::ApeTag; pub struct ApeFile { /// An ID3v1 tag #[lofty(tag_type = "Id3v1")] - pub(crate) id3v1_tag: Option, + pub(crate) id3v1_tag: Option, /// An ID3v2 tag (Not officially supported) #[lofty(tag_type = "Id3v2")] pub(crate) id3v2_tag: Option, diff --git a/src/ape/read.rs b/src/ape/read.rs index c634ed4a1..7a23225b5 100644 --- a/src/ape/read.rs +++ b/src/ape/read.rs @@ -4,7 +4,7 @@ use super::tag::read::read_ape_tag; use super::tag::ApeTag; use super::{ApeFile, ApeProperties}; use crate::error::Result; -use crate::id3::v1::tag::ID3v1Tag; +use crate::id3::v1::tag::Id3v1Tag; use crate::id3::v2::read::parse_id3v2; use crate::id3::v2::tag::Id3v2Tag; use crate::id3::{find_id3v1, find_id3v2, find_lyrics3v2, ID3FindResults}; @@ -25,7 +25,7 @@ where let mut stream_len = end - start; let mut id3v2_tag: Option = None; - let mut id3v1_tag: Option = None; + let mut id3v1_tag: Option = None; let mut ape_tag: Option = None; // ID3v2 tags are unsupported in APE files, but still possible diff --git a/src/id3/mod.rs b/src/id3/mod.rs index b87bc2b5a..1342bb679 100644 --- a/src/id3/mod.rs +++ b/src/id3/mod.rs @@ -49,7 +49,7 @@ where pub(crate) fn find_id3v1( data: &mut R, read: bool, -) -> Result>> +) -> Result>> where R: Read + Seek, { diff --git a/src/id3/v1/mod.rs b/src/id3/v1/mod.rs index 058759214..b3f9a0213 100644 --- a/src/id3/v1/mod.rs +++ b/src/id3/v1/mod.rs @@ -2,7 +2,7 @@ //! //! # ID3v1 notes //! -//! See also: [`ID3v1Tag`] +//! See also: [`Id3v1Tag`] //! //! ## Genres //! @@ -22,4 +22,4 @@ pub(crate) mod write; // Exports pub use constants::GENRES; -pub use tag::ID3v1Tag; +pub use tag::Id3v1Tag; diff --git a/src/id3/v1/read.rs b/src/id3/v1/read.rs index dbc5c1663..1183bf148 100644 --- a/src/id3/v1/read.rs +++ b/src/id3/v1/read.rs @@ -1,8 +1,8 @@ use super::constants::GENRES; -use super::tag::ID3v1Tag; +use super::tag::Id3v1Tag; -pub fn parse_id3v1(reader: [u8; 128]) -> ID3v1Tag { - let mut tag = ID3v1Tag { +pub fn parse_id3v1(reader: [u8; 128]) -> Id3v1Tag { + let mut tag = Id3v1Tag { title: None, artist: None, album: None, diff --git a/src/id3/v1/tag.rs b/src/id3/v1/tag.rs index d106003a9..81bbf051b 100644 --- a/src/id3/v1/tag.rs +++ b/src/id3/v1/tag.rs @@ -56,7 +56,7 @@ macro_rules! impl_accessor { description = "An ID3v1 tag", supported_formats(Aac, Ape, Mpeg, WavPack) )] -pub struct ID3v1Tag { +pub struct Id3v1Tag { /// Track title, 30 bytes max pub title: Option, /// Track artist, 30 bytes max @@ -89,16 +89,16 @@ pub struct ID3v1Tag { pub genre: Option, } -impl ID3v1Tag { +impl Id3v1Tag { /// Create a new empty `ID3v1Tag` /// /// # Examples /// /// ```rust - /// use lofty::id3::v1::ID3v1Tag; + /// use lofty::id3::v1::Id3v1Tag; /// use lofty::TagExt; /// - /// let id3v1_tag = ID3v1Tag::new(); + /// let id3v1_tag = Id3v1Tag::new(); /// assert!(id3v1_tag.is_empty()); /// ``` pub fn new() -> Self { @@ -106,7 +106,7 @@ impl ID3v1Tag { } } -impl Accessor for ID3v1Tag { +impl Accessor for Id3v1Tag { impl_accessor!(title, artist, album,); fn genre(&self) -> Option> { @@ -188,7 +188,7 @@ impl Accessor for ID3v1Tag { } } -impl TagExt for ID3v1Tag { +impl TagExt for Id3v1Tag { type Err = LoftyError; type RefKey<'a> = &'a ItemKey; @@ -254,7 +254,7 @@ impl TagExt for ID3v1Tag { #[derive(Debug, Clone, Default)] pub struct SplitTagRemainder; -impl SplitTag for ID3v1Tag { +impl SplitTag for Id3v1Tag { type Remainder = SplitTagRemainder; fn split_tag(mut self) -> (Self::Remainder, Tag) { @@ -292,20 +292,20 @@ impl SplitTag for ID3v1Tag { } impl MergeTag for SplitTagRemainder { - type Merged = ID3v1Tag; + type Merged = Id3v1Tag; fn merge_tag(self, tag: Tag) -> Self::Merged { tag.into() } } -impl From for Tag { - fn from(input: ID3v1Tag) -> Self { +impl From for Tag { + fn from(input: Id3v1Tag) -> Self { input.split_tag().1 } } -impl From for ID3v1Tag { +impl From for Id3v1Tag { fn from(mut input: Tag) -> Self { let title = input.take_strings(&ItemKey::TrackTitle).next(); let artist = input.take_strings(&ItemKey::TrackArtist).next(); @@ -345,7 +345,7 @@ pub(crate) struct Id3v1TagRef<'a> { pub genre: Option, } -impl<'a> Into> for &'a ID3v1Tag { +impl<'a> Into> for &'a Id3v1Tag { fn into(self) -> Id3v1TagRef<'a> { Id3v1TagRef { title: self.title.as_deref(), @@ -409,12 +409,12 @@ impl<'a> Id3v1TagRef<'a> { #[cfg(test)] mod tests { - use crate::id3::v1::ID3v1Tag; + use crate::id3::v1::Id3v1Tag; use crate::{Tag, TagExt, TagType}; #[test] fn parse_id3v1() { - let expected_tag = ID3v1Tag { + let expected_tag = Id3v1Tag { title: Some(String::from("Foo title")), artist: Some(String::from("Bar artist")), album: Some(String::from("Baz album")), @@ -457,7 +457,7 @@ mod tests { fn tag_to_id3v1() { let tag = crate::tag::utils::test_utils::create_tag(TagType::Id3v1); - let id3v1_tag: ID3v1Tag = tag.into(); + let id3v1_tag: Id3v1Tag = tag.into(); assert_eq!(id3v1_tag.title.as_deref(), Some("Foo title")); assert_eq!(id3v1_tag.artist.as_deref(), Some("Bar artist")); diff --git a/src/id3/v1/write.rs b/src/id3/v1/write.rs index ff58c0db9..d2d066a23 100644 --- a/src/id3/v1/write.rs +++ b/src/id3/v1/write.rs @@ -14,7 +14,7 @@ pub(crate) fn write_id3v1(file: &mut File, tag: &Id3v1TagRef<'_>) -> Result<()> let probe = Probe::new(file).guess_file_type()?; match probe.file_type() { - Some(ft) if super::ID3v1Tag::SUPPORTED_FORMATS.contains(&ft) => {}, + Some(ft) if super::Id3v1Tag::SUPPORTED_FORMATS.contains(&ft) => {}, _ => err!(UnsupportedTag), } diff --git a/src/mpeg/mod.rs b/src/mpeg/mod.rs index 8f639e22a..b36c268d6 100644 --- a/src/mpeg/mod.rs +++ b/src/mpeg/mod.rs @@ -8,7 +8,7 @@ pub use header::{ChannelMode, Emphasis, Layer, MpegVersion}; pub use properties::MpegProperties; use crate::ape::tag::ApeTag; -use crate::id3::v1::tag::ID3v1Tag; +use crate::id3::v1::tag::Id3v1Tag; use crate::id3::v2::tag::Id3v2Tag; use lofty_attr::LoftyFile; @@ -23,7 +23,7 @@ pub struct MpegFile { pub(crate) id3v2_tag: Option, /// An ID3v1 tag #[lofty(tag_type = "Id3v1")] - pub(crate) id3v1_tag: Option, + pub(crate) id3v1_tag: Option, /// An APEv1/v2 tag #[lofty(tag_type = "Ape")] pub(crate) ape_tag: Option, diff --git a/src/wavpack/mod.rs b/src/wavpack/mod.rs index c43253993..d6c0126c3 100644 --- a/src/wavpack/mod.rs +++ b/src/wavpack/mod.rs @@ -3,7 +3,7 @@ mod properties; mod read; use crate::ape::tag::ApeTag; -use crate::id3::v1::tag::ID3v1Tag; +use crate::id3::v1::tag::Id3v1Tag; use lofty_attr::LoftyFile; @@ -17,7 +17,7 @@ pub use properties::WavPackProperties; pub struct WavPackFile { /// An ID3v1 tag #[lofty(tag_type = "Id3v1")] - pub(crate) id3v1_tag: Option, + pub(crate) id3v1_tag: Option, /// An APEv1/v2 tag #[lofty(tag_type = "Ape")] pub(crate) ape_tag: Option, From 8e24e46c8cdf9d567fc70d59704a3606f92fccb3 Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Fri, 28 Apr 2023 02:02:36 -0400 Subject: [PATCH 4/5] changelog: Add entries for ID3 renames --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36d8c5e22..de2a33f44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,9 +17,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **VorbisComments**: `ItemKey::Barcode` mapping ([PR](https://github.com/Serial-ATA/lofty-rs/pull/183)) ### Changed +- **ID3v1**: `ID3v1Tag` -> `Id3v1Tag` - **ID3v2**: - `SyncTextInformation` no longer uses a String for its language ([PR](https://github.com/Serial-ATA/lofty-rs/pull/184)) - `FrameID` -> `FrameId` + - `ID3v2Version` -> `Id3v2Version` + - `ID3v2TagFlags` -> `Id3v2TagFlags` + - `ID3v2Tag` -> `Id3v2Tag` - There are fewer redundant, intermediate allocations ([PR](https://github.com/Serial-ATA/lofty-rs/pull/194)) - **FileType/TagType/ItemKey**: All variants have been changed to UpperCamelCase ([PR](https://github.com/Serial-ATA/lofty-rs/pull/190)) - **MPEG**: From 97869e0c21dbb03379815fbf7d08b959e011852b Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Fri, 28 Apr 2023 02:04:27 -0400 Subject: [PATCH 5/5] lofty_attr: Update reference to `ID3v2TagFlags` --- lofty_attr/src/internal.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lofty_attr/src/internal.rs b/lofty_attr/src/internal.rs index d22ba3277..ea33c1fb6 100644 --- a/lofty_attr/src/internal.rs +++ b/lofty_attr/src/internal.rs @@ -61,7 +61,7 @@ pub(crate) fn init_write_lookup( } else { insert!(map, Id3v2, { lofty::id3::v2::tag::Id3v2TagRef { - flags: lofty::id3::v2::ID3v2TagFlags::default(), + flags: lofty::id3::v2::Id3v2TagFlags::default(), frames: lofty::id3::v2::tag::tag_frames(tag), } .write_to(data)