ID3v2: Rename ID3v2Tag to Id3v2Tag

This commit is contained in:
Serial 2023-04-28 01:55:40 -04:00 committed by Alex
parent af490d0caf
commit cb01e82d07
20 changed files with 98 additions and 98 deletions

View file

@ -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),

View file

@ -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(),
})

View file

@ -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<ID3v2Tag>,
pub(crate) id3v2_tag: Option<Id3v2Tag>,
#[lofty(tag_type = "Id3v1")]
pub(crate) id3v1_tag: Option<ID3v1Tag>,
pub(crate) properties: AACProperties,

View file

@ -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<ID3v1Tag>,
/// An ID3v2 tag (Not officially supported)
#[lofty(tag_type = "Id3v2")]
pub(crate) id3v2_tag: Option<ID3v2Tag>,
pub(crate) id3v2_tag: Option<Id3v2Tag>,
/// An APEv1/v2 tag
#[lofty(tag_type = "Ape")]
pub(crate) ape_tag: Option<ApeTag>,

View file

@ -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<ID3v2Tag> = None;
let mut id3v2_tag: Option<Id3v2Tag> = None;
let mut id3v1_tag: Option<ID3v1Tag> = None;
let mut ape_tag: Option<ApeTag> = None;

View file

@ -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<ID3v2Tag>,
pub(crate) id3v2_tag: Option<Id3v2Tag>,
/// The vorbis comments contained in the file
#[lofty(tag_type = "VorbisComments")]
pub(crate) vorbis_comments_tag: Option<VorbisComments>,

View file

@ -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::*;

View file

@ -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<R>(bytes: &mut R, header: ID3v2Header) -> Result<ID3v2Tag>
pub(crate) fn parse_id3v2<R>(bytes: &mut R, header: ID3v2Header) -> Result<Id3v2Tag>
where
R: Read,
{
@ -29,11 +29,11 @@ where
Ok(ret)
}
fn read_all_frames_into_tag<R>(reader: &mut R, header: ID3v2Header) -> Result<ID3v2Tag>
fn read_all_frames_into_tag<R>(reader: &mut R, header: ID3v2Header) -> Result<Id3v2Tag>
where
R: Read,
{
let mut tag = ID3v2Tag::default();
let mut tag = Id3v2Tag::default();
tag.original_version = header.version;
tag.set_flags(header.flags);

View file

@ -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<Frame<'static>>,
}
impl IntoIterator for ID3v2Tag {
impl IntoIterator for Id3v2Tag {
type Item = Frame<'static>;
type IntoIter = std::vec::IntoIter<Self::Item>;
@ -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<SplitTagRemainder> for ID3v2Tag {
impl From<SplitTagRemainder> 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<Item = &'a ItemKey>,
@ -981,13 +981,13 @@ impl MergeTag for SplitTagRemainder {
}
}
impl From<ID3v2Tag> for Tag {
fn from(input: ID3v2Tag) -> Self {
impl From<Id3v2Tag> for Tag {
fn from(input: Id3v2Tag) -> Self {
input.split_tag().1
}
}
impl From<Tag> for ID3v2Tag {
impl From<Tag> 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(),

View file

@ -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<Item = FrameRef<'a>> + 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 {

View file

@ -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<AIFFTextChunks>,
/// An ID3v2 tag
#[lofty(tag_type = "Id3v2")]
pub(crate) id3v2_tag: Option<ID3v2Tag>,
pub(crate) id3v2_tag: Option<Id3v2Tag>,
/// The file's audio properties
pub(crate) properties: FileProperties,
}

View file

@ -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<ID3v2Tag> = None;
let mut id3v2_tag: Option<Id3v2Tag> = None;
let mut chunks = Chunks::<BigEndian>::new(file_len);

View file

@ -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<B: ByteOrder> Chunks<B> {
Ok(content)
}
pub fn id3_chunk<R>(&mut self, data: &mut R) -> Result<ID3v2Tag>
pub fn id3_chunk<R>(&mut self, data: &mut R) -> Result<Id3v2Tag>
where
R: Read + Seek,
{

View file

@ -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<RIFFInfoList>,
/// An ID3v2 tag
#[lofty(tag_type = "Id3v2")]
pub(crate) id3v2_tag: Option<ID3v2Tag>,
pub(crate) id3v2_tag: Option<Id3v2Tag>,
/// The file's audio properties
pub(crate) properties: WavProperties,
}

View file

@ -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<ID3v2Tag> = None;
let mut id3v2_tag: Option<Id3v2Tag> = None;
let mut chunks = Chunks::<LittleEndian>::new(file_len);

View file

@ -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<ID3v2Tag>,
pub(crate) id3v2_tag: Option<Id3v2Tag>,
/// An ID3v1 tag
#[lofty(tag_type = "Id3v1")]
pub(crate) id3v1_tag: Option<ID3v1Tag>,

View file

@ -130,7 +130,7 @@ pub fn register_custom_resolver<T: FileResolver + 'static>(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<ID3v2Tag>,
id3v2_tag: Option<Id3v2Tag>,
properties: FileProperties,
}
@ -180,7 +180,7 @@ mod tests {
_reader: &mut R,
_parse_options: ParseOptions,
) -> crate::error::Result<Self> {
let mut tag = ID3v2Tag::default();
let mut tag = Id3v2Tag::default();
tag.set_artist(String::from("All is well!"));
Ok(Self {

View file

@ -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 {

View file

@ -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

View file

@ -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"),