v2

package
v0.0.0-...-8b1d50a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HEADERIDENTIFIER string = "ID3"
View Source
const HEADERSIZE int = 10
View Source
const V2_2 string = "ID3v2.2"
View Source
const V2_2FrameHeaderSize uint = 6
View Source
const V2_3 string = "ID3v2.3"
View Source
const V2_3FrameHeaderSize uint = 10
View Source
const V2_4 string = "ID3v2.4"
View Source
const V2_4FrameHeaderSize uint = V2_3FrameHeaderSize

Variables

View Source
var ErrDoesNotUseID3v2 error = fmt.Errorf("does not use ID3v2")
View Source
var ErrGotPadding error = fmt.Errorf("got padding")
View Source
var ErrInvalidID error = fmt.Errorf("invalid identifier")
View Source
var ErrReadMoreThanSize error = fmt.Errorf("read more bytes than size of the whole tag")
View Source
var V2_2FrameIdentifiers = map[string]string{
	"BUF": "Recommended buffer size",
	"CNT": "Play counter",
	"COM": "Comments",
	"CRA": "Audio encryption",
	"CRM": "Encrypted meta frame",
	"ETC": "Event timing codes",
	"EQU": "Equalization",
	"GEO": "General encapsulated object",
	"IPL": "Involved people list",
	"LNK": "Linked information",
	"MCI": "Music CD Identifier",
	"MLL": "MPEG location lookup table",
	"PIC": "Attached picture",
	"POP": "Popularimeter",
	"REV": "Reverb",
	"RVA": "Relative volume adjustment",
	"SLT": "Synchronized lyric/text",
	"STC": "Synced tempo codes",
	"TAL": "Album/Movie/Show title",
	"TBP": "BPM (Beats Per Minute)",
	"TCM": "Composer",
	"TCO": "Content type",
	"TCR": "Copyright message",
	"TDA": "Date",
	"TDY": "Playlist delay",
	"TEN": "Encoded by",
	"TFT": "File type",
	"TIM": "Time",
	"TKE": "Initial key",
	"TLA": "Language(s)",
	"TLE": "Length",
	"TMT": "Media type",
	"TOA": "Original artist(s)/performer(s)",
	"TOF": "Original filename",
	"TOL": "Original Lyricist(s)/text writer(s)",
	"TOR": "Original release year",
	"TOT": "Original album/Movie/Show title",
	"TP1": "Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group",
	"TP2": "Band/Orchestra/Accompaniment",
	"TP3": "Conductor/Performer refinement",
	"TP4": "Interpreted, remixed, or otherwise modified by",
	"TPA": "Part of a set",
	"TPB": "Publisher",
	"TRC": "ISRC (International Standard Recording Code)",
	"TRD": "Recording dates",
	"TRK": "Track number/Position in set",
	"TSI": "Size",
	"TSS": "Software/hardware and settings used for encoding",
	"TT1": "Content group description",
	"TT2": "Title/Songname/Content description",
	"TT3": "Subtitle/Description refinement",
	"TXT": "Lyricist/text writer",
	"TXX": "User defined text information frame",
	"TYE": "Year",
	"UFI": "Unique file identifier",
	"ULT": "Unsychronized lyric/text transcription",
	"WAF": "Official audio file webpage",
	"WAR": "Official artist/performer webpage",
	"WAS": "Official audio source webpage",
	"WCM": "Commercial information",
	"WCP": "Copyright/Legal information",
	"WPB": "Publishers official webpage",
	"WXX": "User defined URL link frame",
}
View Source
var V2_3FrameIdentifiers = map[string]string{
	"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",
}
View Source
var V2_4FrameIdentifiers = map[string]string{

	"ASPI": "Audio seek point index",
	"EQU2": "Equalisation",
	"RVA2": "Relative volume adjustment",
	"SEEK": "Seek frame",
	"SIGN": "Signature frame",
	"TDEN": "Encoding time",
	"TDOR": "Original release time",
	"TDRC": "Recording time",
	"TDRL": "Release time",
	"TDTG": "Tagging time",
	"TIPL": "Involved people list",
	"TMCL": "Musician credits list",
	"TMOO": "Mood",
	"TPRO": "Produced notice",
	"TSOA": "Album sort order",
	"TSOP": "Performer sort order",
	"TSOT": "Title sort order",
	"TSST": "Set subtitle",

	"AENC": "Audio encryption",
	"APIC": "Attached picture",
	"COMM": "Comments",
	"COMR": "Commercial frame",
	"ENCR": "Encryption method registration",
	"ETCO": "Event timing codes",
	"GEOB": "General encapsulated object",
	"GRID": "Group identification registration",
	"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",
	"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",
	"TDLY": "Playlist delay",
	"TENC": "Encoded by",
	"TEXT": "Lyricist/Text writer",
	"TFLT": "File type",
	"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)",
	"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",
	"TRSN": "Internet radio station name",
	"TRSO": "Internet radio station owner",
	"TSRC": "ISRC (international standard recording code)",
	"TSSE": "Software/Hardware and settings used for encoding",
	"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",
}

Functions

func GetFIdentifierDescription

func GetFIdentifierDescription(id string) string

Searches for given ID3v2 frame identifier and returns its description if found, else returns a ""

Types

type ExtendedHeader

type ExtendedHeader struct {
	// contains filtered or unexported fields
}

type ExtendedHeaderFlags

type ExtendedHeaderFlags struct {
	UpdateTag       bool
	CRCpresent      bool
	HasRestrictions bool
	Restrictions    byte // a `lazy` approach :), just for now, maybe...
}

Extended header`s flags

type Frame

type Frame struct {
	Header   FrameHeader
	Contents []byte
}

func NewFrame

func NewFrame(id string, gContents []byte, isTextframe bool) (*Frame, error)

Constructs a new frame from provided information. isTextFrame must be set to true if gContents are not a binary data. Returns an error if provided id`s len is neither 3 or 4

func (*Frame) Text

func (f *Frame) Text() string

Returns decoded string from f.Contents. Note that it can and probably will return corrupted data if you use it on non-text frames such as APIC for such cases please deal with raw []byte

type FrameFlags

type FrameFlags struct {
	TagAlterPreservation   bool
	FileAlterPreservation  bool
	ReadOnly               bool
	Compressed             bool
	Encrypted              bool
	InGroup                bool
	Unsyrchronised         bool
	HasDataLengthIndicator bool
}

type FrameHeader

type FrameHeader struct {
	// contains filtered or unexported fields
}

func (*FrameHeader) Flags

func (fh *FrameHeader) Flags() FrameFlags

func (*FrameHeader) ID

func (fh *FrameHeader) ID() string

func (*FrameHeader) Size

func (fh *FrameHeader) Size() uint32
type Header struct {
	// contains filtered or unexported fields
}

ID3v2.x`s main header structure

func (*Header) ExtendedHeader

func (h *Header) ExtendedHeader() *ExtendedHeader

func (*Header) Flags

func (h *Header) Flags() HeaderFlags

func (*Header) Size

func (h *Header) Size() uint32

func (*Header) Version

func (h *Header) Version() string

type HeaderFlags

type HeaderFlags struct {
	Unsynchronised    bool
	Compressed        bool
	HasExtendedHeader bool
	Experimental      bool
	FooterPresent     bool
}

Main header`s flags

type ID3v2Tag

type ID3v2Tag struct {
	Header  Header
	Frames  []Frame
	Padding uint32
}

func NewTAG

func NewTAG(frames []Frame) *ID3v2Tag

Creates a new v2 tag from given created frames

func ReadV2Tag

func ReadV2Tag(rs io.ReadSeeker) (*ID3v2Tag, error)

Reads the whole ID3v2 tag from rs

func (*ID3v2Tag) Album

func (tag *ID3v2Tag) Album() string

Returns the contents for the album frame

func (*ID3v2Tag) Artist

func (tag *ID3v2Tag) Artist() string

Returns the contents for the artist frame

func (*ID3v2Tag) Comment

func (tag *ID3v2Tag) Comment() string

Returns the contents for the comment frame

func (*ID3v2Tag) FrameExists

func (tag *ID3v2Tag) FrameExists(id string) bool

Checks if a frame with given id exists

func (*ID3v2Tag) GetFrame

func (tag *ID3v2Tag) GetFrame(id string) *Frame

Searches for frame with the same identifier as id in tag, returns &it if found

func (*ID3v2Tag) Picture

func (tag *ID3v2Tag) Picture() []byte

Returns raw bytes of embed picture

func (*ID3v2Tag) Title

func (tag *ID3v2Tag) Title() string

Returns the contents for the title frame

func (*ID3v2Tag) WriteToFile

func (tag *ID3v2Tag) WriteToFile(f *os.File) error

Writes ID3v2Tag to file, removing already existing tag if found

func (*ID3v2Tag) Year

func (tag *ID3v2Tag) Year() string

Returns the contents for the year frame

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL