pub struct Tag { /* private fields */ }
Expand description
An ID3 tag containing zero or more Frame
s.
Implementations
Used for creating new tag with a specific version.
Will return true if the reader is a candidate for an ID3 tag. The reader position will be reset back to the previous position before returning.
Detects the presence of an ID3v2 tag at the current position of the reader and skips it if is found. Returns true if a tag was found.
Removes an ID3v2 tag from the file at the specified path.
Returns true if the file initially contained a tag.
Removes an ID3v2 tag from the specified file.
Returns true if the file initially contained a tag.
Attempts to read an ID3 tag from the reader.
Attempts to read an ID3 tag from the file at the indicated path.
Reads an AIFF stream and returns any present ID3 tag.
Reads an AIFF file at the specified path and returns any present ID3 tag.
Reads an AIFF file and returns any present ID3 tag.
Reads an WAV stream and returns any present ID3 tag.
Reads an WAV file at the specified path and returns any present ID3 tag.
Reads an WAV file and returns any present ID3 tag.
Attempts to write the ID3 tag to the writer using the specified version.
Note that the plain tag is written, regardless of the original contents. To safely encode a
tag to an MP3 file, use Tag::write_to_path
.
Attempts to write the ID3 tag from the file at the indicated path. If the specified path is the same path which the tag was read from, then the tag will be written to the padding if possible.
Overwrite WAV file ID3 chunk in a file
Overwrite AIFF file ID3 chunk in a file. The file must be opened read/write.
Overwrite WAV file ID3 chunk
Overwrite AIFF file ID3 chunk in a file. The file must be opened read/write.
Returns an iterator over the all frames in the tag.
Example
use id3::{Content, Frame, Tag, TagLike};
let mut tag = Tag::new();
tag.add_frame(Frame::with_content("TPE1", Content::Text("".to_string())));
tag.add_frame(Frame::with_content("APIC", Content::Text("".to_string())));
assert_eq!(tag.frames().count(), 2);
Returns an iterator over the extended texts in the tag.
Returns an iterator over the extended links in the tag.
Returns an iterator over the General Encapsulated Object (GEOB) frames in the tag.
Returns an iterator over the comments in the tag.
Example
use id3::{Frame, Tag, TagLike};
use id3::frame::{Content, Comment};
let mut tag = Tag::new();
let frame = Frame::with_content("COMM", Content::Comment(Comment {
lang: "eng".to_owned(),
description: "key1".to_owned(),
text: "value1".to_owned()
}));
tag.add_frame(frame);
let frame = Frame::with_content("COMM", Content::Comment(Comment {
lang: "eng".to_owned(),
description: "key2".to_owned(),
text: "value2".to_owned()
}));
tag.add_frame(frame);
assert_eq!(tag.comments().count(), 2);
Returns an iterator over the lyrics frames in the tag.
Returns an iterator over the synchronised lyrics frames in the tag.
Returns an iterator over the pictures in the tag.
Example
use id3::{Frame, Tag, TagLike};
use id3::frame::{Content, Picture, PictureType};
let mut tag = Tag::new();
let picture = Picture {
mime_type: String::new(),
picture_type: PictureType::Other,
description: String::new(),
data: Vec::new(),
};
tag.add_frame(Frame::with_content("APIC", Content::Picture(picture.clone())));
tag.add_frame(Frame::with_content("APIC", Content::Picture(picture.clone())));
assert_eq!(tag.pictures().count(), 1);
Returns an iterator over all chapters (CHAP) in the tag.
Example
use id3::{Tag, TagLike};
use id3::frame::{Chapter, Content, Frame};
let mut tag = Tag::new();
tag.add_frame(Chapter{
element_id: "01".to_string(),
start_time: 1000,
end_time: 2000,
start_offset: 0xff,
end_offset: 0xff,
frames: Vec::new(),
});
tag.add_frame(Chapter{
element_id: "02".to_string(),
start_time: 2000,
end_time: 3000,
start_offset: 0xff,
end_offset: 0xff,
frames: Vec::new(),
});
assert_eq!(2, tag.chapters().count());
Trait Implementations
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more
Returns a reference to the first frame with the specified identifier. Read more
Adds the frame to the tag, replacing and returning any conflicting frame. Read more
Adds a text frame. Read more
fn set_text_values(
&mut self,
id: impl AsRef<str>,
texts: impl IntoIterator<Item = impl Into<String>>
)
fn set_text_values(
&mut self,
id: impl AsRef<str>,
texts: impl IntoIterator<Item = impl Into<String>>
)
Panics Read more
Remove all frames with the specified identifier and return them. Read more
Returns the year (TYER).
Returns None
if the year frame could not be found or if it could not be parsed. Read more
Removes the year (TYER). Read more
Return the content of the TRDC frame, if any Read more
Sets the content of the TDRC frame Read more
Remove the content of the TDRC frame Read more
Return the content of the TDRL frame, if any Read more
Sets the content of the TDRL frame Read more
Remove the content of the TDRL frame Read more
Sets the artist (TPE1). Read more
Removes the artist (TPE1). Read more
Sets the album artist (TPE2). Read more
Sets the album artist (TPE2). Read more
Removes the album artist (TPE2). Read more
Removes the album (TALB). Read more
Removes the title (TIT2). Read more
Sets the duration (TLEN). Read more
Removes the duration (TLEN). Read more
Removes the genre (TCON). Read more
Removes the disc number (TPOS). Read more
Returns the total number of discs (TPOS). Read more
Sets the total number of discs (TPOS). Read more
Removes the total number of discs (TPOS). Read more
Removes the track number (TRCK). Read more
Returns the total number of tracks (TRCK). Read more
Sets the total number of tracks (TRCK). Read more
Removes the total number of tracks (TCON). Read more
Use add_frame(frame::ExtendedText{ .. })
Adds a user defined text frame (TXXX). Read more
Removes the user defined text frame (TXXX) with the specified key and value. Read more
Use add_frame(frame::Picture{ .. })
Adds a picture frame (APIC). Any other pictures with the same type will be removed from the tag. Read more
Removes all pictures of the specified type. Read more
Removes all pictures. Read more
Removes the comment (COMM) with the specified key and value. Read more
Use add_frame(frame::EncapsulatedObject{ .. })
Adds an encapsulated object frame (GEOB). Read more
Removes the encapsulated object frame (GEOB) with the specified key, MIME type, filename and data. Read more
Removes the lyrics text (USLT) from the tag. Read more
Use add_frame(frame::SynchronisedLyrics{ .. })
Adds a synchronised lyrics frame (SYLT). Read more
Removes all synchronised lyrics (SYLT) frames from the tag. Read more
Adds a single chapter (CHAP) to the farme. Read more
Auto Trait Implementations
impl RefUnwindSafe for Tag
impl UnwindSafe for Tag
Blanket Implementations
Mutably borrows from an owned value. Read more