forked from n10v/id3v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common_ids.go
148 lines (139 loc) · 6.09 KB
/
common_ids.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// Copyright 2016 Albert Nigmatzianov. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package id3v2
import "io"
// Common IDs for ID3v2.3 and ID3v2.4
var (
V23CommonIDs = map[string]string{
"Attached picture": "APIC",
"Comments": "COMM",
"Album/Movie/Show title": "TALB",
"BPM": "TBPM",
"Composer": "TCOM",
"Content type": "TCON",
"Copyright message": "TCOP",
"Date": "TDAT",
"Playlist delay": "TDLY",
"Encoded by": "TENC",
"Lyricist/Text writer": "TEXT",
"File type": "TFLT",
"Time": "TIME",
"Content group description": "TIT1",
"Title/Songname/Content description": "TIT2",
"Subtitle/Description refinement": "TIT3",
"Initial key": "TKEY",
"Language": "TLAN",
"Length": "TLEN",
"Media type": "TMED",
"Original album/movie/show title": "TOAL",
"Original filename": "TOFN",
"Original lyricist/text writer": "TOLY",
"Original artist/performer": "TOPE",
"Original release year": "TORY",
"File owner/licensee": "TOWN",
"Lead artist/Lead performer/Soloist/Performing group": "TPE1",
"Band/Orchestra/Accompaniment": "TPE2",
"Conductor/performer refinement": "TPE3",
"Interpreted, remixed, or otherwise modified by": "TPE4",
"Part of a set": "TPOS",
"Publisher": "TPUB",
"Track number/Position in set": "TRCK",
"Recording dates": "TRDA",
"Internet radio station name": "TRSN",
"Internet radio station owner": "TRSO",
"Size": "TSIZ",
"ISRC": "TSRC",
"Software/Hardware and settings used for encoding": "TSSE",
"Year": "TYER",
"User defined text information frame": "TXXX",
"Unsynchronised lyrics/text transcription": "USLT",
// Just for convenience
"Artist": "TPE1",
"Title": "TIT2",
"Genre": "TCON",
}
V24CommonIDs = map[string]string{
"Attached picture": "APIC",
"Comments": "COMM",
"Album/Movie/Show title": "TALB",
"BPM": "TBPM",
"Composer": "TCOM",
"Content type": "TCON",
"Copyright message": "TCOP",
"Encoding time": "TDEN",
"Playlist delay": "TDLY",
"Original release time": "TDOR",
"Recording time": "TDRC",
"Release time": "TDRL",
"Tagging time": "TDTG",
"Encoded by": "TENC",
"Lyricist/Text writer": "TEXT",
"File type": "TFLT",
"Involved people list": "TIPL",
"Content group description": "TIT1",
"Title/Songname/Content description": "TIT2",
"Subtitle/Description refinement": "TIT3",
"Initial key": "TKEY",
"Language": "TLAN",
"Length": "TLEN",
"Musician credits list": "TMCL",
"Media type": "TMED",
"Mood": "TMOO",
"Original album/movie/show title": "TOAL",
"Original filename": "TOFN",
"Original lyricist/text writer": "TOLY",
"Original artist/performer": "TOPE",
"File owner/licensee": "TOWN",
"Lead artist/Lead performer/Soloist/Performing group": "TPE1",
"Band/Orchestra/Accompaniment": "TPE2",
"Conductor/performer refinement": "TPE3",
"Interpreted, remixed, or otherwise modified by": "TPE4",
"Part of a set": "TPOS",
"Produced notice": "TPRO",
"Publisher": "TPUB",
"Track number/Position in set": "TRCK",
"Internet radio station name": "TRSN",
"Internet radio station owner": "TRSO",
"Album sort order": "TSOA",
"Performer sort order": "TSOP",
"Title sort order": "TSOT",
"ISRC": "TSRC",
"Software/Hardware and settings used for encoding": "TSSE",
"Set subtitle": "TSST",
"User defined text information frame": "TXXX",
"Unsynchronised lyrics/text transcription": "USLT",
// Deprecated ID3v2 frames
"Date": "TDRC",
"Time": "TDRC",
"Original release year": "TDOR",
"Recording dates": "TDRC",
"Size": "",
"Year": "TDRC",
// Just for convenience
"Artist": "TPE1",
"Title": "TIT2",
"Genre": "TCON",
}
)
// parsers is map, where key is ID of frame and value is function for
// parsing corresponding frame.
// You should consider, what there is no text frames. That's why you should
// check at first, if it's a text frame:
// if id[0] == 'T' {
// // use parseTextFrame
// }
var parsers = map[string]func(io.Reader) (Framer, error){
"APIC": parsePictureFrame,
"COMM": parseCommentFrame,
"USLT": parseUnsynchronisedLyricsFrame,
}
// mustFrameBeInSequence checks if frame with corresponding ID must
// be added to sequence.
func mustFrameBeInSequence(id string) bool {
switch id {
case "APIC", "COMM", "USLT":
return true
}
return false
}