diff --git a/src/id3/v2/tag.rs b/src/id3/v2/tag.rs index f7fce49b..2d961cbd 100644 --- a/src/id3/v2/tag.rs +++ b/src/id3/v2/tag.rs @@ -159,8 +159,6 @@ impl Id3v2Tag { impl Id3v2Tag { /// Gets a [`Frame`] from an id - /// - /// NOTE: This is *not* case-sensitive pub fn get(&self, id: &FrameId<'_>) -> Option<&Frame<'static>> { self.frames.iter().find(|f| &f.id == id) } @@ -208,7 +206,7 @@ impl Id3v2Tag { /// /// tag.set_title(String::from("Foo\0Bar")); /// - /// let mut titles = tag.get_texts(&TITLE_ID); + /// let mut titles = tag.get_texts(&TITLE_ID).expect("Should exist"); /// /// assert_eq!(titles.next(), Some("Foo")); /// assert_eq!(titles.next(), Some("Bar")); diff --git a/tests/files/mpeg.rs b/tests/files/mpeg.rs index 00c92794..ded6552a 100644 --- a/tests/files/mpeg.rs +++ b/tests/files/mpeg.rs @@ -1,6 +1,7 @@ use crate::{set_artist, temp_file, verify_artist}; +use std::borrow::Cow; -use lofty::id3::v2::{Frame, FrameFlags, FrameValue, Id3v2Tag, KeyValueFrame}; +use lofty::id3::v2::{Frame, FrameFlags, FrameId, FrameValue, Id3v2Tag, KeyValueFrame}; use lofty::mpeg::MpegFile; use lofty::{ Accessor, AudioFile, FileType, ItemKey, ItemValue, ParseOptions, Probe, Tag, TagExt, TagItem, @@ -344,7 +345,11 @@ fn read_and_write_tpil_frame() { let tag: &Id3v2Tag = mpeg_file.id3v2().unwrap(); - let content = match tag.get("TIPL").unwrap().content() { + let content = match tag + .get(&FrameId::Valid(Cow::Borrowed("TIPL"))) + .unwrap() + .content() + { FrameValue::KeyValue(content) => content, _ => panic!("Wrong Frame Value Type for TIPL"), }; diff --git a/tests/tags/conversions.rs b/tests/tags/conversions.rs index 3d3386f7..b861b454 100644 --- a/tests/tags/conversions.rs +++ b/tests/tags/conversions.rs @@ -1,7 +1,8 @@ // Tests for special case conversions -use lofty::id3::v2::{CommentFrame, Frame, FrameFlags, Id3v2Tag, UnsynchronizedTextFrame}; +use lofty::id3::v2::{CommentFrame, Frame, FrameFlags, FrameId, Id3v2Tag, UnsynchronizedTextFrame}; use lofty::{ItemKey, Tag, TagType, TextEncoding}; +use std::borrow::Cow; #[test] fn tag_to_id3v2_lang_frame() { @@ -12,7 +13,7 @@ fn tag_to_id3v2_lang_frame() { let id3: Id3v2Tag = tag.into(); assert_eq!( - id3.get("USLT"), + id3.get(&FrameId::Valid(Cow::Borrowed("USLT"))), Frame::new( "USLT", UnsynchronizedTextFrame { @@ -28,7 +29,7 @@ fn tag_to_id3v2_lang_frame() { ); assert_eq!( - id3.get("COMM"), + id3.get(&FrameId::Valid(Cow::Borrowed("COMM"))), Frame::new( "COMM", CommentFrame {