catori 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/VERSION +1 -0
  2. data/bin/catori +9 -0
  3. data/changelog.txt +3 -0
  4. data/construir +3 -0
  5. data/crear_vista.sql +8 -0
  6. data/ext/audiofile/MANIFEST +8 -0
  7. data/ext/audiofile/README +11 -0
  8. data/ext/audiofile/audiofile.c +833 -0
  9. data/ext/audiofile/audiofile.rd +265 -0
  10. data/ext/audiofile/depend +0 -0
  11. data/ext/audiofile/extconf.rb +8 -0
  12. data/ext/audiofile/fail.rb +22 -0
  13. data/ext/audiofile/mkmf.log +34 -0
  14. data/ext/audiofile/test.rb +229 -0
  15. data/ext/flac/extconf.rb +5 -0
  16. data/ext/flac/flac.c +75 -0
  17. data/ext/flac/mkmf.log +12 -0
  18. data/ext/flac/test.rb +3 -0
  19. data/ext/mahoro-0.1/INSTALL +9 -0
  20. data/ext/mahoro-0.1/extconf.rb +7 -0
  21. data/ext/mahoro-0.1/mahoro.c +187 -0
  22. data/ext/mahoro-0.1/mkmf.log +24 -0
  23. data/ext/mahoro-0.1/test.rb +41 -0
  24. data/ext/mpc/extconf.rb +5 -0
  25. data/ext/mpc/id3tag.c +245 -0
  26. data/ext/mpc/id3tag.h +5 -0
  27. data/ext/mpc/mkmf.log +12 -0
  28. data/ext/mpc/mpc.c +56 -0
  29. data/ext/mpc/mpp.h +194 -0
  30. data/ext/mpc/mppdec.h +1171 -0
  31. data/ext/mpc/test.rb +3 -0
  32. data/ext/rmac/extconf.rb +7 -0
  33. data/ext/rmac/mkmf.log +22 -0
  34. data/ext/rmac/rmac.cpp +162 -0
  35. data/ext/vorbisfile/ChangeLog +11 -0
  36. data/ext/vorbisfile/README +33 -0
  37. data/ext/vorbisfile/configure +2 -0
  38. data/ext/vorbisfile/extconf.rb +9 -0
  39. data/ext/vorbisfile/mkmf.log +68 -0
  40. data/ext/vorbisfile/test.rb +78 -0
  41. data/ext/vorbisfile/vorbisfile.c +482 -0
  42. data/instalar.txt +19 -0
  43. data/install.rb +11 -0
  44. data/lib/audioinfo.rb +321 -0
  45. data/lib/catori.rb +131 -0
  46. data/lib/catori/Catalogador.rb +71 -0
  47. data/lib/catori/Db.rb +81 -0
  48. data/lib/catori/Gui.rb +52 -0
  49. data/lib/catori/Installer.rb +16 -0
  50. data/lib/catori/Query.rb +82 -0
  51. data/lib/catori/XML.rb +42 -0
  52. data/lib/catori/catori_gui.glade +340 -0
  53. data/lib/catori/catori_gui.glade.bak +340 -0
  54. data/lib/catori/catori_gui.gladep +8 -0
  55. data/lib/catori/catori_gui.gladep.bak +8 -0
  56. data/lib/catori/taglib.rb +227 -0
  57. data/lib/pixmaps/album.png +0 -0
  58. data/lib/pixmaps/artist.png +0 -0
  59. data/lib/pixmaps/cdr.png +0 -0
  60. data/lib/pixmaps/song.png +0 -0
  61. data/lib/taglib.rb +230 -0
  62. data/sql/catori_mysql.sql +68 -0
  63. data/sql/catori_pg.sql +65 -0
  64. data/tests/saw.ape +0 -0
  65. data/tests/saw.flac +0 -0
  66. data/tests/saw.mp3 +0 -0
  67. data/tests/saw.mpc +0 -0
  68. data/tests/saw.ogg +0 -0
  69. data/tests/saw.wav +0 -0
  70. data/tests/test_audioinfo.rb +43 -0
  71. metadata +217 -0
@@ -0,0 +1,340 @@
1
+ <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
2
+ <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
3
+
4
+ <glade-interface>
5
+
6
+ <widget class="GtkWindow" id="window1">
7
+ <property name="visible">True</property>
8
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
9
+ <property name="title" translatable="yes">Catori</property>
10
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
11
+ <property name="window_position">GTK_WIN_POS_NONE</property>
12
+ <property name="modal">False</property>
13
+ <property name="resizable">True</property>
14
+ <property name="destroy_with_parent">False</property>
15
+ <property name="decorated">True</property>
16
+ <property name="skip_taskbar_hint">False</property>
17
+ <property name="skip_pager_hint">False</property>
18
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
19
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
20
+ <property name="focus_on_map">True</property>
21
+ <property name="urgency_hint">False</property>
22
+
23
+ <child>
24
+ <widget class="GtkVBox" id="vbox2">
25
+ <property name="visible">True</property>
26
+ <property name="homogeneous">False</property>
27
+ <property name="spacing">0</property>
28
+
29
+ <child>
30
+ <widget class="GtkTable" id="table1">
31
+ <property name="visible">True</property>
32
+ <property name="n_rows">5</property>
33
+ <property name="n_columns">2</property>
34
+ <property name="homogeneous">False</property>
35
+ <property name="row_spacing">0</property>
36
+ <property name="column_spacing">0</property>
37
+
38
+ <child>
39
+ <widget class="GtkLabel" id="label5">
40
+ <property name="visible">True</property>
41
+ <property name="label" translatable="yes">Artista</property>
42
+ <property name="use_underline">False</property>
43
+ <property name="use_markup">False</property>
44
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
45
+ <property name="wrap">False</property>
46
+ <property name="selectable">False</property>
47
+ <property name="xalign">0</property>
48
+ <property name="yalign">0.5</property>
49
+ <property name="xpad">0</property>
50
+ <property name="ypad">0</property>
51
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
52
+ <property name="width_chars">-1</property>
53
+ <property name="single_line_mode">False</property>
54
+ <property name="angle">0</property>
55
+ </widget>
56
+ <packing>
57
+ <property name="left_attach">0</property>
58
+ <property name="right_attach">1</property>
59
+ <property name="top_attach">0</property>
60
+ <property name="bottom_attach">1</property>
61
+ <property name="x_options">fill</property>
62
+ <property name="y_options"></property>
63
+ </packing>
64
+ </child>
65
+
66
+ <child>
67
+ <widget class="GtkLabel" id="label6">
68
+ <property name="visible">True</property>
69
+ <property name="label" translatable="yes">Album</property>
70
+ <property name="use_underline">False</property>
71
+ <property name="use_markup">False</property>
72
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
73
+ <property name="wrap">False</property>
74
+ <property name="selectable">False</property>
75
+ <property name="xalign">0</property>
76
+ <property name="yalign">0.5</property>
77
+ <property name="xpad">0</property>
78
+ <property name="ypad">0</property>
79
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
80
+ <property name="width_chars">-1</property>
81
+ <property name="single_line_mode">False</property>
82
+ <property name="angle">0</property>
83
+ </widget>
84
+ <packing>
85
+ <property name="left_attach">0</property>
86
+ <property name="right_attach">1</property>
87
+ <property name="top_attach">1</property>
88
+ <property name="bottom_attach">2</property>
89
+ <property name="x_options">fill</property>
90
+ <property name="y_options"></property>
91
+ </packing>
92
+ </child>
93
+
94
+ <child>
95
+ <widget class="GtkLabel" id="label7">
96
+ <property name="visible">True</property>
97
+ <property name="label" translatable="yes">Tema</property>
98
+ <property name="use_underline">False</property>
99
+ <property name="use_markup">False</property>
100
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
101
+ <property name="wrap">False</property>
102
+ <property name="selectable">False</property>
103
+ <property name="xalign">0</property>
104
+ <property name="yalign">0.5</property>
105
+ <property name="xpad">0</property>
106
+ <property name="ypad">0</property>
107
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
108
+ <property name="width_chars">-1</property>
109
+ <property name="single_line_mode">False</property>
110
+ <property name="angle">0</property>
111
+ </widget>
112
+ <packing>
113
+ <property name="left_attach">0</property>
114
+ <property name="right_attach">1</property>
115
+ <property name="top_attach">2</property>
116
+ <property name="bottom_attach">3</property>
117
+ <property name="x_options">fill</property>
118
+ <property name="y_options"></property>
119
+ </packing>
120
+ </child>
121
+
122
+ <child>
123
+ <widget class="GtkLabel" id="label8">
124
+ <property name="visible">True</property>
125
+ <property name="label" translatable="yes">Archivo</property>
126
+ <property name="use_underline">False</property>
127
+ <property name="use_markup">False</property>
128
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
129
+ <property name="wrap">False</property>
130
+ <property name="selectable">False</property>
131
+ <property name="xalign">0</property>
132
+ <property name="yalign">0.5</property>
133
+ <property name="xpad">0</property>
134
+ <property name="ypad">0</property>
135
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
136
+ <property name="width_chars">-1</property>
137
+ <property name="single_line_mode">False</property>
138
+ <property name="angle">0</property>
139
+ </widget>
140
+ <packing>
141
+ <property name="left_attach">0</property>
142
+ <property name="right_attach">1</property>
143
+ <property name="top_attach">3</property>
144
+ <property name="bottom_attach">4</property>
145
+ <property name="x_options">fill</property>
146
+ <property name="y_options"></property>
147
+ </packing>
148
+ </child>
149
+
150
+ <child>
151
+ <widget class="GtkLabel" id="label9">
152
+ <property name="visible">True</property>
153
+ <property name="label" translatable="yes">Medio</property>
154
+ <property name="use_underline">False</property>
155
+ <property name="use_markup">False</property>
156
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
157
+ <property name="wrap">False</property>
158
+ <property name="selectable">False</property>
159
+ <property name="xalign">0</property>
160
+ <property name="yalign">0.5</property>
161
+ <property name="xpad">0</property>
162
+ <property name="ypad">0</property>
163
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
164
+ <property name="width_chars">-1</property>
165
+ <property name="single_line_mode">False</property>
166
+ <property name="angle">0</property>
167
+ </widget>
168
+ <packing>
169
+ <property name="left_attach">0</property>
170
+ <property name="right_attach">1</property>
171
+ <property name="top_attach">4</property>
172
+ <property name="bottom_attach">5</property>
173
+ <property name="x_options">fill</property>
174
+ <property name="y_options"></property>
175
+ </packing>
176
+ </child>
177
+
178
+ <child>
179
+ <widget class="GtkEntry" id="tbartist">
180
+ <property name="visible">True</property>
181
+ <property name="can_focus">True</property>
182
+ <property name="editable">True</property>
183
+ <property name="visibility">True</property>
184
+ <property name="max_length">0</property>
185
+ <property name="text" translatable="yes"></property>
186
+ <property name="has_frame">True</property>
187
+ <property name="invisible_char">*</property>
188
+ <property name="activates_default">False</property>
189
+ </widget>
190
+ <packing>
191
+ <property name="left_attach">1</property>
192
+ <property name="right_attach">2</property>
193
+ <property name="top_attach">0</property>
194
+ <property name="bottom_attach">1</property>
195
+ <property name="y_options"></property>
196
+ </packing>
197
+ </child>
198
+
199
+ <child>
200
+ <widget class="GtkEntry" id="tbalbum">
201
+ <property name="visible">True</property>
202
+ <property name="can_focus">True</property>
203
+ <property name="editable">True</property>
204
+ <property name="visibility">True</property>
205
+ <property name="max_length">0</property>
206
+ <property name="text" translatable="yes"></property>
207
+ <property name="has_frame">True</property>
208
+ <property name="invisible_char">*</property>
209
+ <property name="activates_default">False</property>
210
+ </widget>
211
+ <packing>
212
+ <property name="left_attach">1</property>
213
+ <property name="right_attach">2</property>
214
+ <property name="top_attach">1</property>
215
+ <property name="bottom_attach">2</property>
216
+ <property name="y_options"></property>
217
+ </packing>
218
+ </child>
219
+
220
+ <child>
221
+ <widget class="GtkEntry" id="tbtitle">
222
+ <property name="visible">True</property>
223
+ <property name="can_focus">True</property>
224
+ <property name="editable">True</property>
225
+ <property name="visibility">True</property>
226
+ <property name="max_length">0</property>
227
+ <property name="text" translatable="yes"></property>
228
+ <property name="has_frame">True</property>
229
+ <property name="invisible_char">*</property>
230
+ <property name="activates_default">False</property>
231
+ </widget>
232
+ <packing>
233
+ <property name="left_attach">1</property>
234
+ <property name="right_attach">2</property>
235
+ <property name="top_attach">2</property>
236
+ <property name="bottom_attach">3</property>
237
+ <property name="y_options"></property>
238
+ </packing>
239
+ </child>
240
+
241
+ <child>
242
+ <widget class="GtkEntry" id="tbfile">
243
+ <property name="visible">True</property>
244
+ <property name="can_focus">True</property>
245
+ <property name="editable">True</property>
246
+ <property name="visibility">True</property>
247
+ <property name="max_length">0</property>
248
+ <property name="text" translatable="yes"></property>
249
+ <property name="has_frame">True</property>
250
+ <property name="invisible_char">*</property>
251
+ <property name="activates_default">False</property>
252
+ </widget>
253
+ <packing>
254
+ <property name="left_attach">1</property>
255
+ <property name="right_attach">2</property>
256
+ <property name="top_attach">3</property>
257
+ <property name="bottom_attach">4</property>
258
+ <property name="y_options"></property>
259
+ </packing>
260
+ </child>
261
+
262
+ <child>
263
+ <widget class="GtkEntry" id="tbcd">
264
+ <property name="visible">True</property>
265
+ <property name="can_focus">True</property>
266
+ <property name="editable">True</property>
267
+ <property name="visibility">True</property>
268
+ <property name="max_length">0</property>
269
+ <property name="text" translatable="yes"></property>
270
+ <property name="has_frame">True</property>
271
+ <property name="invisible_char">*</property>
272
+ <property name="activates_default">False</property>
273
+ </widget>
274
+ <packing>
275
+ <property name="left_attach">1</property>
276
+ <property name="right_attach">2</property>
277
+ <property name="top_attach">4</property>
278
+ <property name="bottom_attach">5</property>
279
+ <property name="y_options"></property>
280
+ </packing>
281
+ </child>
282
+ </widget>
283
+ <packing>
284
+ <property name="padding">0</property>
285
+ <property name="expand">False</property>
286
+ <property name="fill">True</property>
287
+ </packing>
288
+ </child>
289
+
290
+ <child>
291
+ <widget class="GtkButton" id="bSearch">
292
+ <property name="visible">True</property>
293
+ <property name="can_focus">True</property>
294
+ <property name="label" translatable="yes">Search</property>
295
+ <property name="use_underline">True</property>
296
+ <property name="relief">GTK_RELIEF_NORMAL</property>
297
+ <property name="focus_on_click">True</property>
298
+ <signal name="clicked" handler="on_bSearch_clicked" last_modification_time="Mon, 07 Apr 2008 05:16:35 GMT"/>
299
+ </widget>
300
+ <packing>
301
+ <property name="padding">0</property>
302
+ <property name="expand">False</property>
303
+ <property name="fill">False</property>
304
+ </packing>
305
+ </child>
306
+
307
+ <child>
308
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
309
+ <property name="visible">True</property>
310
+ <property name="can_focus">True</property>
311
+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
312
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
313
+ <property name="shadow_type">GTK_SHADOW_IN</property>
314
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
315
+
316
+ <child>
317
+ <widget class="GtkTreeView" id="tvSearch">
318
+ <property name="visible">True</property>
319
+ <property name="can_focus">True</property>
320
+ <property name="headers_visible">False</property>
321
+ <property name="rules_hint">False</property>
322
+ <property name="reorderable">False</property>
323
+ <property name="enable_search">True</property>
324
+ <property name="fixed_height_mode">False</property>
325
+ <property name="hover_selection">False</property>
326
+ <property name="hover_expand">False</property>
327
+ </widget>
328
+ </child>
329
+ </widget>
330
+ <packing>
331
+ <property name="padding">0</property>
332
+ <property name="expand">True</property>
333
+ <property name="fill">True</property>
334
+ </packing>
335
+ </child>
336
+ </widget>
337
+ </child>
338
+ </widget>
339
+
340
+ </glade-interface>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
2
+ <!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
3
+
4
+ <glade-project>
5
+ <name></name>
6
+ <program_name></program_name>
7
+ <gnome_support>FALSE</gnome_support>
8
+ </glade-project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
2
+ <!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
3
+
4
+ <glade-project>
5
+ <name></name>
6
+ <program_name></program_name>
7
+ <gnome_support>FALSE</gnome_support>
8
+ </glade-project>
@@ -0,0 +1,227 @@
1
+ # Copyright (C) 2004 Neil Stevens <neil@hakubi.us>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
17
+ # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
+ #
20
+ # Except as contained in this notice, the name(s) of the author(s) shall not be
21
+ # used in advertising or otherwise to promote the sale, use or other dealings
22
+ # in this Software without prior written authorization from the author(s).
23
+
24
+ require 'dl'
25
+ require 'dl/import'
26
+ require 'mahoro'
27
+ module TagLib
28
+
29
+ extend DL::Importable
30
+ dlload 'libtag_c.so'
31
+
32
+ File_Type =
33
+ [
34
+ MPEG = 0,
35
+ OggVorbis = 1,
36
+ FLAC = 2,
37
+ MPC = 3
38
+ ]
39
+
40
+ extern 'void* taglib_file_new(char*)'
41
+ extern 'void* taglib_file_new_type(char*, int)'
42
+ extern 'void taglib_file_free(void*)'
43
+ extern 'void* taglib_file_tag(void*)'
44
+ extern 'void* taglib_file_audioproperties(void*)'
45
+ extern 'void* taglib_file_save(void*)'
46
+
47
+ extern 'char* taglib_tag_title(void*)'
48
+ extern 'char* taglib_tag_artist(void*)'
49
+ extern 'char* taglib_tag_album(void*)'
50
+ extern 'char* taglib_tag_comment(void*)'
51
+ extern 'char* taglib_tag_genre(void*)'
52
+ extern 'uint taglib_tag_year(void*)'
53
+ extern 'uint taglib_tag_track(void*)'
54
+ extern 'void taglib_tag_set_title(void*, char*)'
55
+ extern 'void taglib_tag_set_artist(void*, char*)'
56
+ extern 'void taglib_tag_set_album(void*, char*)'
57
+ extern 'void taglib_tag_set_comment(void*, char*)'
58
+ extern 'void taglib_tag_set_genre(void*, char*)'
59
+ extern 'void taglib_tag_set_year(void*, uint)'
60
+ extern 'void taglib_tag_set_track(void*, uint)'
61
+
62
+ extern 'int taglib_audioproperties_length(void*)'
63
+ extern 'int taglib_audioproperties_bitrate(void*)'
64
+ extern 'int taglib_audioproperties_samplerate(void*)'
65
+ extern 'int taglib_audioproperties_channels(void*)'
66
+
67
+ class BadPath < Exception
68
+ end
69
+
70
+ class BadFile < Exception
71
+ end
72
+
73
+ class BadTag < Exception
74
+ end
75
+
76
+ class BadAudioProperties < Exception
77
+ end
78
+
79
+ class File
80
+
81
+ def initialize(p)
82
+ @path = p
83
+ if not @path
84
+ raise BadPath.new
85
+ end
86
+
87
+ mahoro = Mahoro.new
88
+ mahoro.flags = Mahoro::NONE
89
+ mime = mahoro.file(@path)
90
+ type = taglibForMime(mime)
91
+ if type
92
+ @file = TagLib.taglib_file_new_type(@path, type)
93
+ else
94
+ @file = TagLib.taglib_file_new(@path)
95
+ end
96
+
97
+ if not @file
98
+ @path = nil
99
+ raise BadFile.new
100
+ end
101
+ end
102
+
103
+ def save
104
+ TagLib.taglib_file_save(@file)
105
+ end
106
+
107
+ def close
108
+ if @file
109
+ TagLib.taglib_file_free(@file)
110
+ end
111
+ @path = nil
112
+ @file = nil
113
+ @tag = nil
114
+ @audio = nil
115
+ end
116
+
117
+ def title
118
+ return TagLib.taglib_tag_title(tag)
119
+ end
120
+
121
+ def title=(string)
122
+ TagLib.taglib_tag_set_title(tag, string)
123
+ end
124
+
125
+ def artist
126
+ return TagLib.taglib_tag_artist(tag)
127
+ end
128
+
129
+ def artist=(string)
130
+ TagLib.taglib_tag_set_artist(tag, string)
131
+ end
132
+
133
+ def album
134
+ return TagLib.taglib_tag_album(tag)
135
+ end
136
+
137
+ def album=(string)
138
+ TagLib.taglib_tag_set_album(tag, string)
139
+ end
140
+
141
+ def comment
142
+ return TagLib.taglib_tag_comment(tag)
143
+ end
144
+
145
+ def comment=(string)
146
+ TagLib.taglib_tag_set_comment(tag, string)
147
+ end
148
+
149
+ def genre
150
+ return TagLib.taglib_tag_genre(tag)
151
+ end
152
+
153
+ def genre=(string)
154
+ TagLib.taglib_tag_set_genre(tag, string)
155
+ end
156
+
157
+ def year
158
+ return TagLib.taglib_tag_year(tag)
159
+ end
160
+
161
+ def year=(uint)
162
+ TagLib.taglib_tag_set_year(tag, uint)
163
+ end
164
+
165
+ def track
166
+ return TagLib.taglib_tag_track(tag)
167
+ end
168
+
169
+ def track=(uint)
170
+ TagLib.taglib_tag_set_track(tag, uint)
171
+ end
172
+
173
+ def length
174
+ return TagLib.taglib_audioproperties_length(audio)
175
+ end
176
+
177
+ def bitrate
178
+ return TagLib.taglib_audioproperties_bitrate(audio)
179
+ end
180
+
181
+ def samplerate
182
+ return TagLib.taglib_audioproperties_samplerate(audio)
183
+ end
184
+
185
+ def channels
186
+ return TagLib.taglib_audioproperties_channels(audio)
187
+ end
188
+
189
+ private
190
+ def tag
191
+ if not @tag
192
+ @tag = TagLib.taglib_file_tag(@file)
193
+ if not @tag
194
+ raise BadTag.new
195
+ end
196
+ end
197
+ return @tag
198
+ end
199
+
200
+ def audio
201
+ if not @audio
202
+ @audio = TagLib.taglib_file_audioproperties(@file)
203
+ if not @audio
204
+ raise BadAudioProperties.new
205
+ end
206
+ end
207
+ return @audio
208
+ end
209
+
210
+ def taglibForMime(mime)
211
+ if mime.include?('MP3')
212
+ return TagLib::MPEG
213
+ end
214
+
215
+ if mime.include?('Ogg') or mime.include?('ogg')
216
+ if mime.include?('Vorbis') or mime.include('vorbis')
217
+ return TagLib::OggVorbis
218
+ elsif mime.include?('FLAC')
219
+ return TagLib::FLAC
220
+ end
221
+ end
222
+
223
+ return nil
224
+ end
225
+ end
226
+
227
+ end