Class ID3v2
In: lib/mp3info/id3v2.rb
Parent: DelegateClass(Hash)

This class can be used to decode id3v2 tags from files, like .mp3 or .ape for example. It works like a hash, where key represents the tag name as 3 or 4 upper case letters (respectively related to 2.2 and 2.3+ tag) and value represented as array or raw value. Written version is always 2.3.

Methods

changed?   from_io   new   parsed?   to_bin   version  

Included Modules

Mp3Info::HashKeys

Constants

WRITE_VERSION = 3   Major version used when writing tags
TAGS = { "AENC" => "Audio encryption", "APIC" => "Attached picture", "COMM" => "Comments", "COMR" => "Commercial frame", "ENCR" => "Encryption method registration", "EQUA" => "Equalization", "ETCO" => "Event timing codes", "GEOB" => "General encapsulated object", "GRID" => "Group identification registration", "IPLS" => "Involved people list", "LINK" => "Linked information", "MCDI" => "Music CD identifier", "MLLT" => "MPEG location lookup table", "OWNE" => "Ownership frame", "PRIV" => "Private frame", "PCNT" => "Play counter", "POPM" => "Popularimeter", "POSS" => "Position synchronisation frame", "RBUF" => "Recommended buffer size", "RVAD" => "Relative volume adjustment", "RVRB" => "Reverb", "SYLT" => "Synchronized lyric/text", "SYTC" => "Synchronized tempo codes", "TALB" => "Album/Movie/Show title", "TBPM" => "BPM (beats per minute)", "TCOM" => "Composer", "TCON" => "Content type", "TCOP" => "Copyright message", "TDAT" => "Date", "TDLY" => "Playlist delay", "TENC" => "Encoded by", "TEXT" => "Lyricist/Text writer", "TFLT" => "File type", "TIME" => "Time", "TIT1" => "Content group description", "TIT2" => "Title/songname/content description", "TIT3" => "Subtitle/Description refinement", "TKEY" => "Initial key", "TLAN" => "Language(s)", "TLEN" => "Length", "TMED" => "Media type", "TOAL" => "Original album/movie/show title", "TOFN" => "Original filename", "TOLY" => "Original lyricist(s)/text writer(s)", "TOPE" => "Original artist(s)/performer(s)", "TORY" => "Original release year", "TOWN" => "File owner/licensee", "TPE1" => "Lead performer(s)/Soloist(s)", "TPE2" => "Band/orchestra/accompaniment", "TPE3" => "Conductor/performer refinement", "TPE4" => "Interpreted, remixed, or otherwise modified by", "TPOS" => "Part of a set", "TPUB" => "Publisher", "TRCK" => "Track number/Position in set", "TRDA" => "Recording dates", "TRSN" => "Internet radio station name", "TRSO" => "Internet radio station owner", "TSIZ" => "Size", "TSRC" => "ISRC (international standard recording code)", "TSSE" => "Software/Hardware and settings used for encoding", "TYER" => "Year", "TXXX" => "User defined text information frame", "UFID" => "Unique file identifier", "USER" => "Terms of use", "USLT" => "Unsychronized lyric/text transcription", "WCOM" => "Commercial information", "WCOP" => "Copyright/Legal information", "WOAF" => "Official audio file webpage", "WOAR" => "Official artist/performer webpage", "WOAS" => "Official audio source webpage", "WORS" => "Official internet radio station homepage", "WPAY" => "Payment", "WPUB" => "Publishers official webpage", "WXXX" => "User defined URL link frame"
TAG_MAPPING_2_2_to_2_3 = { "BUF" => "RBUF", "COM" => "COMM", "CRA" => "AENC", "EQU" => "EQUA", "ETC" => "ETCO", "GEO" => "GEOB", "MCI" => "MCDI", "MLL" => "MLLT", "PIC" => "APIC", "POP" => "POPM", "REV" => "RVRB", "RVA" => "RVAD", "SLT" => "SYLT", "STC" => "SYTC", "TAL" => "TALB", "TBP" => "TBPM", "TCM" => "TCOM", "TCO" => "TCON", "TCR" => "TCOP", "TDA" => "TDAT", "TDY" => "TDLY", "TEN" => "TENC", "TFT" => "TFLT", "TIM" => "TIME", "TKE" => "TKEY", "TLA" => "TLAN", "TLE" => "TLEN", "TMT" => "TMED", "TOA" => "TOPE", "TOF" => "TOFN", "TOL" => "TOLY", "TOR" => "TORY", "TOT" => "TOAL", "TP1" => "TPE1", "TP2" => "TPE2", "TP3" => "TPE3", "TP4" => "TPE4", "TPA" => "TPOS", "TPB" => "TPUB", "TRC" => "TSRC", "TRD" => "TRDA", "TRK" => "TRCK", "TSI" => "TSIZ", "TSS" => "TSSE", "TT1" => "TIT1", "TT2" => "TIT2", "TT3" => "TIT3", "TXT" => "TEXT", "TXX" => "TXXX", "TYE" => "TYER", "UFI" => "UFID", "ULT" => "USLT", "WAF" => "WOAF", "WAR" => "WOAR", "WAS" => "WOAS", "WCM" => "WCOM", "WCP" => "WCOP", "WPB" => "WPB", "WXX" => "WXXX", }   Translate V2 to V3 tags
TEXT_ENCODINGS = ["iso-8859-1", "utf-16", "utf-16be", "utf-8"]   See id3v2.4.0-structure document, at section 4.

Attributes

io_position  [R]  this is the position in the file where the tag really ends
options  [R]  :lang: for writing comments

:encoding: one of the string of TEXT_ENCODINGS, used as a source and destination encoding respectively for read and write tag2 values.

Public Class methods

possible options are described above (‘options’ attribute) you can access this object like an hash, with [] and []= methods special cases are ["disc_number"] and ["disc_total"] mirroring TPOS attribute

Public Instance methods

does this tag has been changed ?

gets id3v2 tag information from io object (must support seek() method)

does this tag has been correctly read ?

dump tag for writing. Version is always 2.#{WRITE_VERSION}.0.

full version of this tag (like "2.3.0") or nil if tag was not correctly read

[Validate]