UNPKG

6.59 kBJavaScriptView Raw
1const FRAME_IDENTIFIERS = {
2 v2: {
3 album: "TAL",
4 bpm: "TBP",
5 composer: "TCM",
6 genre: "TCO",
7 copyright: "TCR",
8 date: "TDA",
9 playlistDelay: "TDY",
10 encodedBy: "TEN",
11 textWriter: "TEXT",
12 fileType: "TFT",
13 time: "TIM",
14 contentGroup: "TT1",
15 title: "TT2",
16 subtitle: "TT3",
17 initialKey: "TKE",
18 language: "TLA",
19 length: "TLE",
20 mediaType: "TMT",
21 originalTitle: "TOT",
22 originalFilename: "TOF",
23 originalTextwriter: "TOL",
24 originalArtist: "TOA",
25 originalYear: "TOR",
26 artist: "TP1",
27 performerInfo: "TP2",
28 conductor: "TP3",
29 remixArtist: "TP4",
30 partOfSet: "TPA",
31 publisher: "TPB",
32 trackNumber: "TRK",
33 recordingDates: "TRD",
34 size: "TSI",
35 ISRC: "TRC",
36 encodingTechnology: "TSS",
37 year: "TYE",
38 image: "PIC",
39 commercialUrl: "WCM",
40 copyrightUrl: "WCP",
41 fileUrl: "WAF",
42 artistUrl: "WAR",
43 audioSourceUrl: "WAS",
44 publisherUrl: "WPB",
45 userDefinedUrl: "WXX"
46 },
47 v3: {
48 album: "TALB",
49 bpm: "TBPM",
50 composer: "TCOM",
51 genre: "TCON",
52 copyright: "TCOP",
53 date: "TDAT",
54 playlistDelay: "TDLY",
55 encodedBy: "TENC",
56 textWriter: "TEXT",
57 fileType: "TFLT",
58 time: "TIME",
59 contentGroup: "TIT1",
60 title: "TIT2",
61 subtitle: "TIT3",
62 initialKey: "TKEY",
63 language: "TLAN",
64 length: "TLEN",
65 mediaType: "TMED",
66 originalTitle: "TOAL",
67 originalFilename: "TOFN",
68 originalTextwriter: "TOLY",
69 originalArtist: "TOPE",
70 originalYear: "TORY",
71 fileOwner: "TOWN",
72 artist: "TPE1",
73 performerInfo: "TPE2",
74 conductor: "TPE3",
75 remixArtist: "TPE4",
76 partOfSet: "TPOS",
77 publisher: "TPUB",
78 trackNumber: "TRCK",
79 recordingDates: "TRDA",
80 internetRadioName: "TRSN",
81 internetRadioOwner: "TRSO",
82 size: "TSIZ",
83 ISRC: "TSRC",
84 encodingTechnology: "TSSE",
85 year: "TYER",
86 comment: "COMM",
87 image: "APIC",
88 unsynchronisedLyrics: "USLT",
89 userDefinedText: "TXXX",
90 popularimeter: "POPM",
91 private: "PRIV",
92 chapter: "CHAP",
93 tableOfContents: "CTOC",
94 userDefinedUrl: "WXXX",
95 commercialUrl: "WCOM",
96 copyrightUrl: "WCOP",
97 fileUrl: "WOAF",
98 artistUrl: "WOAR",
99 audioSourceUrl: "WOAS",
100 radioStationUrl: "WORS",
101 paymentUrl: "WPAY",
102 publisherUrl: "WPUB"
103 }
104}
105
106const FRAME_INTERNAL_IDENTIFIERS = {
107 v2: Object.keys(FRAME_IDENTIFIERS.v2).reduce((acc, key) => {
108 acc[FRAME_IDENTIFIERS.v2[key]] = key
109 return acc
110 }, {}),
111 v3: Object.keys(FRAME_IDENTIFIERS.v3).reduce((acc, key) => {
112 acc[FRAME_IDENTIFIERS.v3[key]] = key
113 return acc
114 }, {})
115}
116
117const ID3_FRAME_OPTIONS = {
118 v2: {
119 "PIC": {
120 multiple: false /* change in 1.0 */
121 },
122 "WCM": {
123 multiple: true
124 },
125 "WAR": {
126 multiple: true
127 }
128 },
129 v3: {
130 "T___": {
131 multiple: false
132 },
133 "TXXX": {
134 multiple: true,
135 updateCompareKey: "description"
136 },
137 "APIC": {
138 multiple: false /* change in 1.0 */
139 },
140 "USLT": {
141 multiple: false
142 },
143 "COMM": {
144 multiple: false /* change in 1.0 */
145 },
146 "POPM": {
147 multiple: false /* change in 1.0 */
148 },
149 "PRIV": {
150 multiple: true
151 },
152 "CTOC": {
153 multiple: true
154 },
155 "CHAP": {
156 multiple: true
157 },
158 "WXXX": {
159 multiple: true,
160 updateCompareKey: "description"
161 },
162 "WCOM": {
163 multiple: true
164 },
165 "WOAR": {
166 multiple: true
167 }
168 }
169}
170
171/*
172** List of official text information frames
173** LibraryName: "T***"
174** Value is the ID of the text frame specified in the link above, the object's keys are just for simplicity, you can also use the ID directly.
175*/
176
177/*
178** Officially available types of the picture frame
179*/
180const APICTypes = [
181 "other",
182 "file icon",
183 "other file icon",
184 "front cover",
185 "back cover",
186 "leaflet page",
187 "media",
188 "lead artist",
189 "artist",
190 "conductor",
191 "band",
192 "composer",
193 "lyricist",
194 "recording location",
195 "during recording",
196 "during performance",
197 "video screen capture",
198 "a bright coloured fish",
199 "illustration",
200 "band logotype",
201 "publisher logotype"
202]
203
204const ENCODINGS = [
205 'ISO-8859-1', 'UTF-16', 'UTF-16BE', 'utf8'
206]
207
208module.exports.APIC_TYPES = APICTypes
209module.exports.ENCODINGS = ENCODINGS
210module.exports.FRAME_IDENTIFIERS = FRAME_IDENTIFIERS
211module.exports.FRAME_INTERNAL_IDENTIFIERS = FRAME_INTERNAL_IDENTIFIERS
212module.exports.ID3_FRAME_OPTIONS = ID3_FRAME_OPTIONS