pub struct Id3v1Tag {
pub title: Option<String>,
pub artist: Option<String>,
pub album: Option<String>,
pub year: Option<String>,
pub comment: Option<String>,
pub track_number: Option<u8>,
pub genre: Option<u8>,
}Expand description
An ID3v1 tag
§Supported file types
ID3v1 is a severely limited format, with each field being incredibly small in size. All fields have been commented with their maximum sizes and any other additional restrictions.
Attempting to write a field greater than the maximum size will not error, it will just be shrunk.
§Conversions
§To Tag
All fields can be translated to a TagItem:
title->ItemKey::TrackTitleartist->ItemKey::TrackArtistalbum->ItemKey::AlbumTitleyear->ItemKey::Yearcomment->ItemKey::Commenttrack_number->ItemKey::TrackNumbergenre->ItemKey::Genre(As long as the genre is a valid index intoGENRES)
§From Tag
All of the ItemKeys referenced in the conversion to Tag will be checked.
The values will be used as-is, with two exceptions:
-
ItemKey::TrackNumber- Will only be used if the value can be parsed as au8 -
ItemKey::Genre- Will only be used if:GENREScontains the string OR TheItemValuecan be parsed into au8and it is a valid index intoGENRES
Fields§
§title: Option<String>Track title, 30 bytes max
artist: Option<String>Track artist, 30 bytes max
album: Option<String>Album title, 30 bytes max
year: Option<String>Release year, 4 bytes max
comment: Option<String>A short comment
The number of bytes differs between versions, but not much. A V1 tag may have been read, which limits this field to 30 bytes. A V1.1 tag, however, only has 28 bytes available.
Lofty will always write a V1.1 tag.
track_number: Option<u8>The track number, 1 byte max
Issues:
- The track number cannot be 0. Many readers, including Lofty, look for a null byte at the end of the comment to differentiate between V1 and V1.1.
- A V1 tag may have been read, which does not have a track number.
genre: Option<u8>The track’s genre, 1 byte max
ID3v1 has a predefined set of genres, see GENRES.
This byte should be an index to a genre.