Enum multitag::Tag

source ·
pub enum Tag {
    Id3Tag {
        inner: Tag,
    },
    VorbisFlacTag {
        inner: Tag,
    },
    Mp4Tag {
        inner: Tag,
    },
    OpusTag {
        inner: Tag,
    },
}
Expand description

An object containing tags of one of the supported formats.

Variants§

§

Id3Tag

Fields

§inner: Tag
§

VorbisFlacTag

Fields

§inner: Tag
§

Mp4Tag

Fields

§inner: Tag
§

OpusTag

Fields

§inner: Tag

Implementations§

source§

impl Tag

source

pub fn read_from_path<P: AsRef<Path>>(path: P) -> Result<Self>

Attempts to read a set of tags from the given path.

§Errors

This function could error if the given path has a file extension which contains invalid unicode or if the given path does not have a file extension at all.

This function could also error if the given path has a valid extension but the extension is not among the types supported by this crate.

Lastly, an error will be raised if the file type is supported but the reading the tags fails for some reason other than missing tags.

source

pub fn write_to_path<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

Attempts to write the tags to the indicated path.

§Errors

This function will error if writing the tags fails in any way.

source

pub fn new_empty_id3() -> Self

Creates an empty set of tags in the ID3 format.

source

pub fn new_empty_flac() -> Self

Creates an empty set of tags in the FLAC format.

source

pub fn new_empty_mp4() -> Self

Creates an empty set of tags in the MP4 format.

source§

impl Tag

source

pub fn get_album_info(&self) -> Option<Album>

Gets the album information. If the album or album_artist fields are not present in the audio file, this method returns None.

source

pub fn set_album_info(&mut self, album: Album) -> Result<()>

Sets the album information of the audio track.

§Errors

This function will error if album.cover has an invalid or unsupported MIME type. Supported MIME types are: image/bmp, image/jpeg, image/png

source

pub fn remove_all_album_info(&mut self)

Removes all album infofrom the audio track.

source

pub fn title(&self) -> Option<&str>

Gets the title.

source

pub fn set_title(&mut self, title: &str)

Sets the title.

source

pub fn remove_title(&mut self)

Removes any title fields from the file.

source

pub fn artist(&self) -> Option<String>

Gets the artist (note: NOT the album artist!) If multiple ARTIST tags are present, they will be joined with a ;

source

pub fn set_artist(&mut self, artist: &str)

Sets the artist (note: NOT the album artist!)

source

pub fn remove_artist(&mut self)

Removes the artist (note: NOT the album artist!)

source

pub fn date(&self) -> Option<Timestamp>

Gets the date

§Format-specific

In id3, this method corresponds to the date_released field.

source

pub fn set_date(&mut self, timestamp: Timestamp)

Sets the date

§Format-specific

In id3, this method corresponds to the date_released field.

source

pub fn remove_date(&mut self)

Removes the date

§Format-specific

In id3, this method corresponds to the date_released field.

source

pub fn copy_to(&self, other: &mut Self)

Copies the information of this Tag to another. The target Tag can be any of the supported formats.

Auto Trait Implementations§

§

impl Freeze for Tag

§

impl RefUnwindSafe for Tag

§

impl Send for Tag

§

impl Sync for Tag

§

impl Unpin for Tag

§

impl UnwindSafe for Tag

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.