Struct id3::Tag

source · []
pub struct Tag { /* private fields */ }
Expand description

An ID3 tag containing zero or more Frames.

Implementations

Creates a new ID3v2.4 tag with no frames.

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 version of the read tag.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Converts to this type from the input type.

Creates a value from an iterator. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

Sets the year (TYER). 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

Returns the artist (TPE1). 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

Returns the album (TALB). Read more

Sets the album (TALB). Read more

Removes the album (TALB). Read more

Returns the title (TIT2). Read more

Sets the title (TIT2). Read more

Removes the title (TIT2). Read more

Returns the duration (TLEN). Read more

Sets the duration (TLEN). Read more

Removes the duration (TLEN). Read more

Returns the genre (TCON). Read more

Sets the genre (TCON). Read more

Removes the genre (TCON). Read more

Returns the disc number (TPOS). Read more

Sets the disc (TPOS). 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

Returns the track number (TRCK). Read more

Sets the track (TRCK). 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

👎 Deprecated:

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

👎 Deprecated:

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

👎 Deprecated:

Use add_frame(frame::Comment{ .. })

Adds a comment (COMM). Read more

Removes the comment (COMM) with the specified key and value. Read more

👎 Deprecated:

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

👎 Deprecated:

Use add_frame(frame::Lyrics{ .. })

Sets the lyrics (USLT). Read more

Removes the lyrics text (USLT) from the tag. Read more

👎 Deprecated:

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.