id3lib-ruby 0.3.0-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,103 @@
1
+
2
+ module ID3Lib
3
+
4
+ #
5
+ # The Accessors module defines accessor methods for ID3 text frames.
6
+ #
7
+ # === Most used accessors
8
+ #
9
+ # Here's a list of the most used accessors:
10
+ #
11
+ # * #title
12
+ # * #performer or #artist
13
+ # * #album
14
+ # * #genre or #content_type
15
+ # * #year
16
+ # * #track
17
+ # * #part_of_set or #disc
18
+ # * #comment or #comment_frames
19
+ # * #composer
20
+ # * #bpm
21
+ #
22
+ module Accessors
23
+
24
+ def title() frame_text(:TIT2) end
25
+ def title=(v) set_frame_text(:TIT2, v) end
26
+
27
+ def performer() frame_text(:TPE1) end
28
+ def performer=(v) set_frame_text(:TPE1, v) end
29
+ alias artist performer
30
+ alias artist= performer=
31
+
32
+ def album() frame_text(:TALB) end
33
+ def album=(v) set_frame_text(:TALB, v) end
34
+
35
+ def genre() frame_text(:TCON) end
36
+ def genre=(v) set_frame_text(:TCON, v) end
37
+ alias content_type genre
38
+ alias content_type= genre=
39
+
40
+ def year() frame_text(:TYER) end
41
+ def year=(v) set_frame_text(:TYER, v) end
42
+
43
+ def track() frame_text(:TRCK) end
44
+ def track=(v) set_frame_text(:TRCK, v) end
45
+
46
+ def part_of_set() frame_text(:TPOS) end
47
+ def part_of_set=(v) set_frame_text(:TPOS, v) end
48
+ alias disc part_of_set
49
+ alias disc= part_of_set=
50
+
51
+ def comment() frame_text(:COMM) end
52
+ def comment=(v) set_frame_text(:COMM, v) end
53
+
54
+ # Returns an array of comment frames.
55
+ def comment_frames() select{ |f| f[:id] == :COMM } end
56
+
57
+ def composer() frame_text(:TCOM) end
58
+ def composer=(v) set_frame_text(:TCOM, v) end
59
+
60
+ def grouping() frame_text(:TIT1) end
61
+ def grouping=(v) set_frame_text(:TIT1, v) end
62
+
63
+ def bpm() frame_text(:TBPM) end
64
+ def bpm=(v) set_frame_text(:TBPM, v.to_s) end
65
+
66
+ def subtitle() frame_text(:TIT3) end
67
+ def subtitle=(v) set_frame_text(:TIT3, v) end
68
+
69
+ def date() frame_text(:TDAT) end
70
+ def date=(v) set_frame_text(:TDAT, v) end
71
+
72
+ def time() frame_text(:TIME) end
73
+ def time=(v) set_frame_text(:TIME, v) end
74
+
75
+ def language() frame_text(:TLAN) end
76
+ def language=(v) set_frame_text(:TLAN, v) end
77
+
78
+ def lyrics() frame_text(:USLT) end
79
+ def lyrics=(v) set_frame_text(:USLT, v) end
80
+
81
+ def lyricist() frame_text(:TEXT) end
82
+ def lyricist=(v) set_frame_text(:TEXT, v) end
83
+
84
+ def band() frame_text(:TPE2) end
85
+ def band=(v) set_frame_text(:TPE2, v) end
86
+
87
+ def conductor() frame_text(:TPE3) end
88
+ def conductor=(v) set_frame_text(:TPE3, v) end
89
+
90
+ def interpreted_by() frame_text(:TPE4) end
91
+ def interpreted_by=(v) set_frame_text(:TPE4, v) end
92
+ alias remixed_by interpreted_by
93
+ alias remixed_by= interpreted_by=
94
+
95
+ def publisher() frame_text(:TPUB) end
96
+ def publisher=(v) set_frame_text(:TPUB, v) end
97
+
98
+ def encoded_by() frame_text(:TENC) end
99
+ def encoded_by=(v) set_frame_text(:TENC, v) end
100
+
101
+ end
102
+
103
+ end
@@ -0,0 +1,389 @@
1
+
2
+ module ID3Lib
3
+
4
+ #
5
+ # Use this module to obtain information about ID3 frames, fields and genres.
6
+ #
7
+ # === Frame information
8
+ #
9
+ # Access the information through the #frame function or
10
+ # through direct access on the Frames array.
11
+ #
12
+ # For example to get all the frames which take a :textenc and a :text field:
13
+ #
14
+ # ID3Lib::Info::Frames.select{ |f| f[3] == [:textenc, :text] }
15
+ #
16
+ # The frame information is stored in an array. Let's have a look at it:
17
+ #
18
+ # f = ID3Lib::Info.frame(:AENC)
19
+ #
20
+ # f[0] #=> 1
21
+ # #=> internal ID for id3lib
22
+ #
23
+ # f[1] #=> :AENC
24
+ # #=> frame ID as specified in ID3 standard
25
+ #
26
+ # f[2] #=> "Audio encryption"
27
+ # #=> description according to id3lib
28
+ #
29
+ # f[3] #=> [:owner, :data]
30
+ # #=> IDs of fields allowed in that frame
31
+ #
32
+ # === Field information
33
+ #
34
+ # Use the #field function or the Fields array to access field information.
35
+ #
36
+ # The array for a field is:
37
+ #
38
+ # f = ID3Lib::Info.field(:text)
39
+ #
40
+ # f[0] #=> 2
41
+ # #=> internal ID
42
+ #
43
+ # f[1] #=> :text
44
+ # #=> field ID
45
+ #
46
+ # f[2] #=> "Text field"
47
+ # #=> description
48
+ #
49
+ # === Genre information
50
+ #
51
+ # Genre information is useful if you want to set the genre of an ID3v1 tag
52
+ # or to get an overview of genres.
53
+ #
54
+ # ID3Lib::Info::Genres.index("Pop") #=> 13
55
+ #
56
+ module Info
57
+
58
+ #
59
+ # Please note that these frames are not fully supported by id3lib:
60
+ # AENC, ASPI, COMR, EQUA, ETCO, LINK, MLLT,
61
+ # OWNE, POSS, RBUF, RVA2, RVAD, RVRB, SEEK
62
+ #
63
+ Frames = [
64
+ # Special frames
65
+ [0, :____, "No known frame", []],
66
+ [1, :AENC, "Audio encryption", [:owner, :data]],
67
+ [2, :APIC, "Attached picture", [:textenc, :mimetype, :picturetype, :description, :data]],
68
+ [3, :ASPI, "Audio seek point index", [:data]],
69
+ [4, :COMM, "Comments", [:textenc, :language, :description, :text]],
70
+ [5, :COMR, "Commercial frame", [:data]],
71
+ [6, :ENCR, "Encryption method registration", [:owner, :id, :data]],
72
+ [7, :EQU2, "Equalisation (2)", [:id, :text]],
73
+ [8, :EQUA, "Equalization", [:data]],
74
+ [9, :ETCO, "Event timing codes", [:data]],
75
+ [10, :GEOB, "General encapsulated object", [:textenc, :mimetype, :filename, :description, :data]],
76
+ [11, :GRID, "Group identification registration", [:owner, :id, :data]],
77
+ [12, :IPLS, "Involved people list", [:textenc, :text]],
78
+ [13, :LINK, "Linked information", [:data]],
79
+ [14, :MCDI, "Music CD identifier", [:data]],
80
+ [15, :MLLT, "MPEG location lookup table", [:data]],
81
+ [16, :OWNE, "Ownership frame", [:data]],
82
+ [17, :PRIV, "Private frame", [:owner, :data]],
83
+ [18, :PCNT, "Play counter", [:counter]],
84
+ [19, :POPM, "Popularimeter", [:email, :rating, :counter]],
85
+ [20, :POSS, "Position synchronisation frame", [:data]],
86
+ [21, :RBUF, "Recommended buffer size", [:data]],
87
+ [22, :RVA2, "Relative volume adjustment (2)", [:data]],
88
+ [23, :RVAD, "Relative volume adjustment", [:data]],
89
+ [24, :RVRB, "Reverb", [:data]],
90
+ [25, :SEEK, "Seek frame", [:data]],
91
+ [26, :SIGN, "Signature frame", [:id, :data]],
92
+ [27, :SYLT, "Synchronized lyric/text", [:textenc, :language, :timestampformat, :contenttype, :description, :data]],
93
+ [28, :SYTC, "Synchronized tempo codes", [:timestampformat, :data]],
94
+ # Text information frames
95
+ [29, :TALB, "Album/Movie/Show title", [:textenc, :text]],
96
+ [30, :TBPM, "BPM (beats per minute)", [:textenc, :text]],
97
+ [31, :TCOM, "Composer", [:textenc, :text]],
98
+ [32, :TCON, "Content type", [:textenc, :text]],
99
+ [33, :TCOP, "Copyright message", [:textenc, :text]],
100
+ [34, :TDAT, "Date", [:textenc, :text]],
101
+ [35, :TDEN, "Encoding time", [:textenc, :text]],
102
+ [36, :TDLY, "Playlist delay", [:textenc, :text]],
103
+ [37, :TDOR, "Original release time", [:textenc, :text]],
104
+ [38, :TDRC, "Recording time", [:textenc, :text]],
105
+ [39, :TDRL, "Release time", [:textenc, :text]],
106
+ [40, :TDTG, "Tagging time", [:textenc, :text]],
107
+ [41, :TIPL, "Involved people list", [:textenc, :text]],
108
+ [42, :TENC, "Encoded by", [:textenc, :text]],
109
+ [43, :TEXT, "Lyricist/Text writer", [:textenc, :text]],
110
+ [44, :TFLT, "File type", [:textenc, :text]],
111
+ [45, :TIME, "Time", [:textenc, :text]],
112
+ [46, :TIT1, "Content group description", [:textenc, :text]],
113
+ [47, :TIT2, "Title/songname/content description", [:textenc, :text]],
114
+ [48, :TIT3, "Subtitle/Description refinement", [:textenc, :text]],
115
+ [49, :TKEY, "Initial key", [:textenc, :text]],
116
+ [50, :TLAN, "Language(s)", [:textenc, :text]],
117
+ [51, :TLEN, "Length", [:textenc, :text]],
118
+ [52, :TMCL, "Musician credits list", [:textenc, :text]],
119
+ [53, :TMED, "Media type", [:textenc, :text]],
120
+ [54, :TMOO, "Mood", [:textenc, :text]],
121
+ [55, :TOAL, "Original album/movie/show title", [:textenc, :text]],
122
+ [56, :TOFN, "Original filename", [:textenc, :text]],
123
+ [57, :TOLY, "Original lyricist(s)/text writer(s)", [:textenc, :text]],
124
+ [58, :TOPE, "Original artist(s)/performer(s)", [:textenc, :text]],
125
+ [59, :TORY, "Original release year", [:textenc, :text]],
126
+ [60, :TOWN, "File owner/licensee", [:textenc, :text]],
127
+ [61, :TPE1, "Lead performer(s)/Soloist(s)", [:textenc, :text]],
128
+ [62, :TPE2, "Band/orchestra/accompaniment", [:textenc, :text]],
129
+ [63, :TPE3, "Conductor/performer refinement", [:textenc, :text]],
130
+ [64, :TPE4, "Interpreted, remixed, or otherwise modified by", [:textenc, :text]],
131
+ [65, :TPOS, "Part of a set", [:textenc, :text]],
132
+ [66, :TPRO, "Produced notice", [:textenc, :text]],
133
+ [67, :TPUB, "Publisher", [:textenc, :text]],
134
+ [68, :TRCK, "Track number/Position in set", [:textenc, :text]],
135
+ [69, :TRDA, "Recording dates", [:textenc, :text]],
136
+ [70, :TRSN, "Internet radio station name", [:textenc, :text]],
137
+ [71, :TRSO, "Internet radio station owner", [:textenc, :text]],
138
+ [72, :TSIZ, "Size", [:textenc, :text]],
139
+ [73, :TSOA, "Album sort order", [:textenc, :text]],
140
+ [74, :TSOP, "Performer sort order", [:textenc, :text]],
141
+ [75, :TSOT, "Title sort order", [:textenc, :text]],
142
+ [76, :TSRC, "ISRC (international standard recording code)", [:textenc, :text]],
143
+ [77, :TSSE, "Software/Hardware and settings used for encoding", [:textenc, :text]],
144
+ [78, :TSST, "Set subtitle", [:textenc, :text]],
145
+ [79, :TXXX, "User defined text information", [:textenc, :text]],
146
+ [80, :TYER, "Year", [:textenc, :text]],
147
+ # Special frames again
148
+ [81, :UFID, "Unique file identifier", [:owner, :data]],
149
+ [82, :USER, "Terms of use", [:textenc, :language, :text]],
150
+ [83, :USLT, "Unsynchronized lyric/text transcription", [:textenc, :language, :description, :text]],
151
+ # URL link frames
152
+ [84, :WCOM, "Commercial information", [:text]],
153
+ [85, :WCOP, "Copyright/Legal infromation", [:text]],
154
+ [86, :WOAF, "Official audio file webpage", [:text]],
155
+ [87, :WOAR, "Official artist/performer webpage", [:text]],
156
+ [88, :WOAS, "Official audio source webpage", [:text]],
157
+ [89, :WORS, "Official internet radio station homepage", [:text]],
158
+ [90, :WPAY, "Payment", [:text]],
159
+ [91, :WPUB, "Official publisher webpage", [:text]],
160
+ [92, :WXXX, "User defined URL link", [:textenc, :description, :url]],
161
+ ]
162
+
163
+ FramesByID = {
164
+ :____ => Frames[0],
165
+ :AENC => Frames[1],
166
+ :APIC => Frames[2],
167
+ :ASPI => Frames[3],
168
+ :COMM => Frames[4],
169
+ :COMR => Frames[5],
170
+ :ENCR => Frames[6],
171
+ :EQU2 => Frames[7],
172
+ :EQUA => Frames[8],
173
+ :ETCO => Frames[9],
174
+ :GEOB => Frames[10],
175
+ :GRID => Frames[11],
176
+ :IPLS => Frames[12],
177
+ :LINK => Frames[13],
178
+ :MCDI => Frames[14],
179
+ :MLLT => Frames[15],
180
+ :OWNE => Frames[16],
181
+ :PRIV => Frames[17],
182
+ :PCNT => Frames[18],
183
+ :POPM => Frames[19],
184
+ :POSS => Frames[20],
185
+ :RBUF => Frames[21],
186
+ :RVA2 => Frames[22],
187
+ :RVAD => Frames[23],
188
+ :RVRB => Frames[24],
189
+ :SEEK => Frames[25],
190
+ :SIGN => Frames[26],
191
+ :SYLT => Frames[27],
192
+ :SYTC => Frames[28],
193
+ :TALB => Frames[29],
194
+ :TBPM => Frames[30],
195
+ :TCOM => Frames[31],
196
+ :TCON => Frames[32],
197
+ :TCOP => Frames[33],
198
+ :TDAT => Frames[34],
199
+ :TDEN => Frames[35],
200
+ :TDLY => Frames[36],
201
+ :TDOR => Frames[37],
202
+ :TDRC => Frames[38],
203
+ :TDRL => Frames[39],
204
+ :TDTG => Frames[40],
205
+ :TIPL => Frames[41],
206
+ :TENC => Frames[42],
207
+ :TEXT => Frames[43],
208
+ :TFLT => Frames[44],
209
+ :TIME => Frames[45],
210
+ :TIT1 => Frames[46],
211
+ :TIT2 => Frames[47],
212
+ :TIT3 => Frames[48],
213
+ :TKEY => Frames[49],
214
+ :TLAN => Frames[50],
215
+ :TLEN => Frames[51],
216
+ :TMCL => Frames[52],
217
+ :TMED => Frames[53],
218
+ :TMOO => Frames[54],
219
+ :TOAL => Frames[55],
220
+ :TOFN => Frames[56],
221
+ :TOLY => Frames[57],
222
+ :TOPE => Frames[58],
223
+ :TORY => Frames[59],
224
+ :TOWN => Frames[60],
225
+ :TPE1 => Frames[61],
226
+ :TPE2 => Frames[62],
227
+ :TPE3 => Frames[63],
228
+ :TPE4 => Frames[64],
229
+ :TPOS => Frames[65],
230
+ :TPRO => Frames[66],
231
+ :TPUB => Frames[67],
232
+ :TRCK => Frames[68],
233
+ :TRDA => Frames[69],
234
+ :TRSN => Frames[70],
235
+ :TRSO => Frames[71],
236
+ :TSIZ => Frames[72],
237
+ :TSOA => Frames[73],
238
+ :TSOP => Frames[74],
239
+ :TSOT => Frames[75],
240
+ :TSRC => Frames[76],
241
+ :TSSE => Frames[77],
242
+ :TSST => Frames[78],
243
+ :TXXX => Frames[79],
244
+ :TYER => Frames[80],
245
+ :UFID => Frames[81],
246
+ :USER => Frames[82],
247
+ :USLT => Frames[83],
248
+ :WCOM => Frames[84],
249
+ :WCOP => Frames[85],
250
+ :WOAF => Frames[86],
251
+ :WOAR => Frames[87],
252
+ :WOAS => Frames[88],
253
+ :WORS => Frames[89],
254
+ :WPAY => Frames[90],
255
+ :WPUB => Frames[91],
256
+ :WXXX => Frames[92],
257
+ }
258
+
259
+ Fields = [
260
+ [0, :nofield, "No field"],
261
+ [1, :textenc, "Text encoding (unicode or ASCII)"],
262
+ [2, :text, "Text field"],
263
+ [3, :url, "A URL"],
264
+ [4, :data, "Data field"],
265
+ [5, :description, "Description field"],
266
+ [6, :owner, "Owner field"],
267
+ [7, :email, "Email field"],
268
+ [8, :rating, "Rating field"],
269
+ [9, :filename, "Filename field"],
270
+ [10, :language, "Language field"],
271
+ [11, :picturetype, "Picture type field"],
272
+ [12, :imageformat, "Image format field"],
273
+ [13, :mimetype, "Mimetype field"],
274
+ [14, :counter, "Counter field"],
275
+ [15, :id, "Identifier/Symbol field"],
276
+ [16, :volumeadj, "Volume adjustment field"],
277
+ [17, :numbits, "Number of bits field"],
278
+ [18, :volchgright, "Volume chage on the right channel"],
279
+ [19, :volchgleft, "Volume chage on the left channel"],
280
+ [20, :peakvolright, "Peak volume on the right channel"],
281
+ [21, :peakvolleft, "Peak volume on the left channel"],
282
+ [22, :timestampformat, "SYLT Timestamp Format"],
283
+ [23, :contenttype, "SYLT content type"]
284
+ ]
285
+
286
+ FieldsByID = {
287
+ :nofield => Fields[0],
288
+ :textenc => Fields[1],
289
+ :text => Fields[2],
290
+ :url => Fields[3],
291
+ :data => Fields[4],
292
+ :description => Fields[5],
293
+ :owner => Fields[6],
294
+ :email => Fields[7],
295
+ :rating => Fields[8],
296
+ :filename => Fields[9],
297
+ :language => Fields[10],
298
+ :picturetype => Fields[11],
299
+ :imageformat => Fields[12],
300
+ :mimetype => Fields[13],
301
+ :counter => Fields[14],
302
+ :id => Fields[15],
303
+ :volumeadj => Fields[16],
304
+ :numbits => Fields[17],
305
+ :volchgright => Fields[18],
306
+ :volchgleft => Fields[19],
307
+ :peakvolright => Fields[20],
308
+ :peakvolleft => Fields[21],
309
+ :timestampformat => Fields[22],
310
+ :contenttype => Fields[23],
311
+ }
312
+
313
+ FieldType = {
314
+ 0 => :integer,
315
+ 1 => :binary,
316
+ 2 => :text
317
+ }
318
+
319
+ Genres = [
320
+ "Blues", "Classic Rock", "Country", "Dance",
321
+ "Disco", "Funk", "Grunge", "Hip-Hop",
322
+ "Jazz", "Metal", "New Age", "Oldies",
323
+ "Other", "Pop", "R&B", "Rap",
324
+ "Reggae", "Rock", "Techno", "Industrial",
325
+ "Alternative", "Ska", "Death Metal", "Pranks",
326
+ "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop",
327
+ "Vocal", "Jazz+Funk", "Fusion", "Trance",
328
+ "Classical", "Instrumental", "Acid", "House",
329
+ "Game", "Sound Clip", "Gospel", "Noise",
330
+ "AlternRock", "Bass", "Soul", "Punk",
331
+ "Space", "Meditative", "Instrumental Pop", "Instrumental Rock",
332
+ "Ethnic", "Gothic", "Darkwave", "Techno-Industrial",
333
+ "Electronic", "Pop-Folk", "Eurodance", "Dream",
334
+ "Southern Rock", "Comedy", "Cult", "Gangsta",
335
+ "Top 40", "Christian Rap", "Pop/Funk", "Jungle",
336
+ "Native American", "Cabaret", "New Wave", "Psychadelic",
337
+ "Rave", "Showtunes", "Trailer", "Lo-Fi",
338
+ "Tribal", "Acid Punk", "Acid Jazz", "Polka",
339
+ "Retro", "Musical", "Rock & Roll", "Hard Rock",
340
+ # Winamp extensions
341
+ "Folk", "Folk-Rock", "National Folk", "Swing",
342
+ "Fast Fusion", "Bebob", "Latin", "Revival",
343
+ "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock",
344
+ "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock",
345
+ "Big Band", "Chorus", "Easy Listening", "Acoustic",
346
+ "Humour", "Speech", "Chanson", "Opera",
347
+ "Chamber Music", "Sonata", "Symphony", "Booty Bass",
348
+ "Primus", "Porn Groove", "Satire", "Slow Jam",
349
+ "Club", "Tango", "Samba", "Folklore",
350
+ "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle",
351
+ "Duet", "Punk Rock", "Drum Solo", "A capella",
352
+ "Euro-House", "Dance Hall", "Goa", "Drum & Bass",
353
+ "Club-House", "Hardcore", "Terror", "Indie",
354
+ "Britpop", "Negerpunk", "Polsk Punk", "Beat",
355
+ "Christian Gangsta Rap", "Heavy Metal", "Black Metal", "Crossover",
356
+ "Contemporary Christian", "Christian Rock ", "Merengue", "Salsa",
357
+ "Trash Metal", "Anime", "JPop", "Synthpop",
358
+ ]
359
+
360
+
361
+ #
362
+ # Get information of frame specified by _id_.
363
+ #
364
+ # ID3Lib::Info.frame(:TIT2) #=> [47, :TIT2, "Title/songname/content description", [:textenc, :text]]
365
+ #
366
+ def self.frame(id)
367
+ FramesByID[id]
368
+ end
369
+
370
+ def self.frame_num(num)
371
+ Frames[num]
372
+ end
373
+
374
+ #
375
+ # Get information of field specified by _id_.
376
+ #
377
+ # ID3Lib::Info.field(:text) #=> [2, :text, "Text field"]
378
+ #
379
+ def self.field(id)
380
+ FieldsByID[id]
381
+ end
382
+
383
+ def self.field_num(num)
384
+ Fields[num]
385
+ end
386
+
387
+ end
388
+
389
+ end