taglib2 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/ChangeLog +5 -0
- data/Rakefile +112 -0
- data/compat/taglib.rb +0 -6
- data/lib/taglib2.rb +1 -1
- data/taglib2.c +50 -2
- metadata +5 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
data/Rakefile
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright 2010 Vincent Carmona
|
4
|
+
vinc4mai+taglib@gmail.com
|
5
|
+
|
6
|
+
This file is part of ruby-taglib2.
|
7
|
+
|
8
|
+
ruby-taglib2 is free software; you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Public License as published by
|
10
|
+
the Free Software Foundation; either version 2 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
ruby-taglib2 is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License
|
19
|
+
along with ruby-taglib2; if not, write to the Free Software
|
20
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
=end
|
22
|
+
|
23
|
+
require 'rake/rdoctask'
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
compat=ENV['COMPAT']=="true"
|
27
|
+
|
28
|
+
#Default task
|
29
|
+
task :default => :build
|
30
|
+
|
31
|
+
#Building
|
32
|
+
file "Makefile" => ["extconf.rb"] do
|
33
|
+
extconf="extconf.rb"
|
34
|
+
extconf+=" --compat" if compat
|
35
|
+
ruby(extconf)
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Build librairy"
|
39
|
+
task :build => "Makefile" do
|
40
|
+
sh("make")
|
41
|
+
end
|
42
|
+
|
43
|
+
Rake::RDocTask.new do |rd|
|
44
|
+
rd.options << "--exclude" << "extconf.rb"
|
45
|
+
rd.options << "--exclude" << "tests/"
|
46
|
+
end
|
47
|
+
|
48
|
+
#Testing
|
49
|
+
Rake::TestTask.new do |t|
|
50
|
+
t.libs=[]
|
51
|
+
t.test_files=FileList['tests/tests.rb']
|
52
|
+
t.options=" --compat" if compat
|
53
|
+
end
|
54
|
+
|
55
|
+
#Installing
|
56
|
+
|
57
|
+
desc "Install librairy"
|
58
|
+
task :install => :build do
|
59
|
+
sh("make install")
|
60
|
+
end
|
61
|
+
|
62
|
+
#Cleaning
|
63
|
+
desc "Remove any temporary products."
|
64
|
+
task :clean do
|
65
|
+
sh("make clean") if File.exist?("Makefile")
|
66
|
+
end
|
67
|
+
|
68
|
+
desc "Remove any generated file."
|
69
|
+
task :clobber do
|
70
|
+
sh("make distclean") if File.exist?("Makefile")
|
71
|
+
end
|
72
|
+
|
73
|
+
begin
|
74
|
+
require 'rubygems'
|
75
|
+
require 'rake/gempackagetask.rb'
|
76
|
+
|
77
|
+
files=FileList['lib/**/*.rb', "compat/taglib.rb", '*.h', '*.c', 'extconf.rb',
|
78
|
+
'ChangeLog', 'COPYING', 'README', 'Rakefile']
|
79
|
+
ext=FileList["extconf.rb"]
|
80
|
+
rdoc_options=["taglib2.c"]
|
81
|
+
|
82
|
+
def retrieve_version
|
83
|
+
File.open('lib/taglib2.rb'){|f| l=f.readlines}.
|
84
|
+
grep(/VERSION=\[(\d+).*(\d+).*(\d+)\]/){$1+"."+$2+"."+$3}[0]
|
85
|
+
end
|
86
|
+
|
87
|
+
spec=Gem::Specification.new do |s|
|
88
|
+
s.name='taglib2'
|
89
|
+
s.version=retrieve_version
|
90
|
+
s.summary="ruby-taglib2 is a Ruby interface to TagLib, the audio meta-data library. It allows Ruby programs to read and write meta-data of all the audio formats supported by TagLib. It was written because ruby-taglib suffers severals bugs with ruby 1.9."
|
91
|
+
s.author="Vincent Carmona"
|
92
|
+
s.email="vinc4mai@gmail.com"
|
93
|
+
s.rubyforge_project='zik'
|
94
|
+
s.homepage="http://zik.rubyforge.org/ruby-taglib2"
|
95
|
+
s.license="General Public License v2"
|
96
|
+
|
97
|
+
s.files=files.to_a
|
98
|
+
s.extensions=ext.to_a
|
99
|
+
|
100
|
+
s.rdoc_options=rdoc_options
|
101
|
+
|
102
|
+
if ENV['GEM_PRIVATE_KEY']&&ENV['GEM_CERTIFICATE_CHAIN']
|
103
|
+
s.signing_key=ENV['GEM_PRIVATE_KEY']
|
104
|
+
s.cert_chain=ENV['GEM_CERTIFICATE_CHAIN'].split(" ")
|
105
|
+
else
|
106
|
+
$stderr.puts "WARNING: gem will not be signed."
|
107
|
+
end
|
108
|
+
end
|
109
|
+
Rake::GemPackageTask.new(spec){}
|
110
|
+
rescue LoadError => e
|
111
|
+
$stderr.puts "WARNING: "+e
|
112
|
+
end
|
data/compat/taglib.rb
CHANGED
data/lib/taglib2.rb
CHANGED
data/taglib2.c
CHANGED
@@ -27,16 +27,18 @@ typedef struct
|
|
27
27
|
TagLib_File *file;
|
28
28
|
TagLib_Tag *tag;
|
29
29
|
const TagLib_AudioProperties *audio;
|
30
|
+
int closed;
|
30
31
|
} tgFileData;
|
31
32
|
|
32
33
|
VALUE mTagLib;
|
33
|
-
VALUE eBadFile, eBadTag, eBadAudioProperties;
|
34
|
+
VALUE eBadFile, eBadTag, eBadAudioProperties, eFileClosed;
|
34
35
|
VALUE cFile;
|
35
36
|
|
36
37
|
static void
|
37
38
|
free_tgFileData(tgFileData *d)
|
38
39
|
{
|
39
|
-
|
40
|
+
if (!d->closed)
|
41
|
+
taglib_file_free(d->file);
|
40
42
|
free(d);
|
41
43
|
}
|
42
44
|
|
@@ -74,6 +76,16 @@ file_audio(VALUE self)
|
|
74
76
|
return d->audio;
|
75
77
|
}
|
76
78
|
|
79
|
+
void
|
80
|
+
file_check_closed(VALUE self)
|
81
|
+
{
|
82
|
+
tgFileData *d;
|
83
|
+
|
84
|
+
Data_Get_Struct(self, tgFileData, d);
|
85
|
+
if (d->closed)
|
86
|
+
rb_raise(eFileClosed, "File closed");
|
87
|
+
}
|
88
|
+
|
77
89
|
/*:nodoc:*/
|
78
90
|
VALUE
|
79
91
|
file_alloc(VALUE self)
|
@@ -83,6 +95,7 @@ file_alloc(VALUE self)
|
|
83
95
|
data=ALLOC(tgFileData);
|
84
96
|
data->tag=NULL;
|
85
97
|
data->audio=NULL;
|
98
|
+
data->closed=0;
|
86
99
|
return Data_Wrap_Struct(self, 0, free_tgFileData, data);
|
87
100
|
}
|
88
101
|
|
@@ -126,6 +139,7 @@ file_save(VALUE self)
|
|
126
139
|
{
|
127
140
|
tgFileData *data;
|
128
141
|
|
142
|
+
file_check_closed(self);
|
129
143
|
Data_Get_Struct(self, tgFileData, data);
|
130
144
|
if (taglib_file_save(data->file))
|
131
145
|
{
|
@@ -137,12 +151,27 @@ file_save(VALUE self)
|
|
137
151
|
}
|
138
152
|
}
|
139
153
|
|
154
|
+
/*Close audio file*/
|
155
|
+
VALUE
|
156
|
+
file_close(VALUE self)
|
157
|
+
{
|
158
|
+
tgFileData *data;
|
159
|
+
|
160
|
+
Data_Get_Struct(self, tgFileData, data);
|
161
|
+
if (data->closed)
|
162
|
+
return self;
|
163
|
+
taglib_file_free(data->file);
|
164
|
+
data->closed=1;
|
165
|
+
return self;
|
166
|
+
}
|
167
|
+
|
140
168
|
/*Get track title*/
|
141
169
|
VALUE
|
142
170
|
file_get_title(VALUE self)
|
143
171
|
{
|
144
172
|
VALUE str;
|
145
173
|
|
174
|
+
file_check_closed(self);
|
146
175
|
str=rb_str_new2(taglib_tag_title(file_tag(self)));
|
147
176
|
taglib_tag_free_strings;
|
148
177
|
return str;
|
@@ -157,6 +186,7 @@ Set track title to title
|
|
157
186
|
VALUE
|
158
187
|
file_set_title(VALUE self, VALUE title)
|
159
188
|
{
|
189
|
+
file_check_closed(self);
|
160
190
|
taglib_tag_set_title(file_tag(self), StringValuePtr(title));
|
161
191
|
return title;
|
162
192
|
}
|
@@ -167,6 +197,7 @@ file_get_artist(VALUE self)
|
|
167
197
|
{
|
168
198
|
VALUE str;
|
169
199
|
|
200
|
+
file_check_closed(self);
|
170
201
|
str=rb_str_new2(taglib_tag_artist(file_tag(self)));
|
171
202
|
taglib_tag_free_strings;
|
172
203
|
return str;
|
@@ -181,6 +212,7 @@ Set track artist to artist
|
|
181
212
|
VALUE
|
182
213
|
file_set_artist(VALUE self, VALUE artist)
|
183
214
|
{
|
215
|
+
file_check_closed(self);
|
184
216
|
taglib_tag_set_artist(file_tag(self), StringValuePtr(artist));
|
185
217
|
return artist;
|
186
218
|
}
|
@@ -191,6 +223,7 @@ file_get_album(VALUE self)
|
|
191
223
|
{
|
192
224
|
VALUE str;
|
193
225
|
|
226
|
+
file_check_closed(self);
|
194
227
|
str=rb_str_new2(taglib_tag_album(file_tag(self)));
|
195
228
|
taglib_tag_free_strings;
|
196
229
|
return str;
|
@@ -205,6 +238,7 @@ Set track album to album
|
|
205
238
|
VALUE
|
206
239
|
file_set_album(VALUE self, VALUE album)
|
207
240
|
{
|
241
|
+
file_check_closed(self);
|
208
242
|
taglib_tag_set_album(file_tag(self), StringValuePtr(album));
|
209
243
|
return album;
|
210
244
|
}
|
@@ -215,6 +249,7 @@ file_get_comment(VALUE self)
|
|
215
249
|
{
|
216
250
|
VALUE str;
|
217
251
|
|
252
|
+
file_check_closed(self);
|
218
253
|
str=rb_str_new2(taglib_tag_comment(file_tag(self)));
|
219
254
|
taglib_tag_free_strings;
|
220
255
|
return str;
|
@@ -229,6 +264,7 @@ Set track comment to comment
|
|
229
264
|
VALUE
|
230
265
|
file_set_comment(VALUE self, VALUE comment)
|
231
266
|
{
|
267
|
+
file_check_closed(self);
|
232
268
|
taglib_tag_set_comment(file_tag(self), StringValuePtr(comment));
|
233
269
|
return comment;
|
234
270
|
}
|
@@ -239,6 +275,7 @@ file_get_genre(VALUE self)
|
|
239
275
|
{
|
240
276
|
VALUE str;
|
241
277
|
|
278
|
+
file_check_closed(self);
|
242
279
|
str=rb_str_new2(taglib_tag_genre(file_tag(self)));
|
243
280
|
taglib_tag_free_strings;
|
244
281
|
return str;
|
@@ -253,6 +290,7 @@ Set track genre to genre
|
|
253
290
|
VALUE
|
254
291
|
file_set_genre(VALUE self, VALUE genre)
|
255
292
|
{
|
293
|
+
file_check_closed(self);
|
256
294
|
taglib_tag_set_genre(file_tag(self), StringValuePtr(genre));
|
257
295
|
return genre;
|
258
296
|
}
|
@@ -261,6 +299,7 @@ file_set_genre(VALUE self, VALUE genre)
|
|
261
299
|
VALUE
|
262
300
|
file_get_year(VALUE self)
|
263
301
|
{
|
302
|
+
file_check_closed(self);
|
264
303
|
return INT2FIX(taglib_tag_year(file_tag(self)));
|
265
304
|
}
|
266
305
|
|
@@ -273,6 +312,7 @@ Set track year to year
|
|
273
312
|
VALUE
|
274
313
|
file_set_year(VALUE self, VALUE year)
|
275
314
|
{
|
315
|
+
file_check_closed(self);
|
276
316
|
taglib_tag_set_year(file_tag(self), NUM2INT(year));
|
277
317
|
return year;
|
278
318
|
}
|
@@ -281,6 +321,7 @@ file_set_year(VALUE self, VALUE year)
|
|
281
321
|
VALUE
|
282
322
|
file_get_track(VALUE self)
|
283
323
|
{
|
324
|
+
file_check_closed(self);
|
284
325
|
return INT2FIX(taglib_tag_track(file_tag(self)));
|
285
326
|
}
|
286
327
|
|
@@ -293,6 +334,7 @@ Set track number to number
|
|
293
334
|
VALUE
|
294
335
|
file_set_track(VALUE self, VALUE track)
|
295
336
|
{
|
337
|
+
file_check_closed(self);
|
296
338
|
taglib_tag_set_track(file_tag(self), NUM2INT(track));
|
297
339
|
return track;
|
298
340
|
}
|
@@ -301,6 +343,7 @@ file_set_track(VALUE self, VALUE track)
|
|
301
343
|
VALUE
|
302
344
|
file_get_length(VALUE self)
|
303
345
|
{
|
346
|
+
file_check_closed(self);
|
304
347
|
return INT2NUM(taglib_audioproperties_length(file_audio(self)));
|
305
348
|
}
|
306
349
|
|
@@ -308,6 +351,7 @@ file_get_length(VALUE self)
|
|
308
351
|
VALUE
|
309
352
|
file_get_bitrate(VALUE self)
|
310
353
|
{
|
354
|
+
file_check_closed(self);
|
311
355
|
return INT2NUM(taglib_audioproperties_bitrate(file_audio(self)));
|
312
356
|
}
|
313
357
|
|
@@ -315,6 +359,7 @@ file_get_bitrate(VALUE self)
|
|
315
359
|
VALUE
|
316
360
|
file_get_samplerate(VALUE self)
|
317
361
|
{
|
362
|
+
file_check_closed(self);
|
318
363
|
return INT2NUM(taglib_audioproperties_samplerate(file_audio(self)));
|
319
364
|
}
|
320
365
|
|
@@ -322,6 +367,7 @@ file_get_samplerate(VALUE self)
|
|
322
367
|
VALUE
|
323
368
|
file_get_channels(VALUE self)
|
324
369
|
{
|
370
|
+
file_check_closed(self);
|
325
371
|
return INT2NUM(taglib_audioproperties_channels(file_audio(self)));
|
326
372
|
}
|
327
373
|
|
@@ -342,6 +388,7 @@ ruby-taglib2 is a Ruby interface to TagLib, the audio meta-data library.
|
|
342
388
|
eBadFile=rb_define_class_under(mTagLib, "BadFile", rb_eException);
|
343
389
|
eBadTag=rb_define_class_under(mTagLib, "BadTag", rb_eException);
|
344
390
|
eBadAudioProperties=rb_define_class_under(mTagLib, "BadAudioProperties", rb_eException);
|
391
|
+
eFileClosed=rb_define_class_under(mTagLib, "FileClosed", rb_eException);
|
345
392
|
|
346
393
|
rb_define_const(mTagLib, "MPEG", INT2FIX(TagLib_File_MPEG));
|
347
394
|
rb_define_const(mTagLib, "OggVorbis", INT2FIX(TagLib_File_OggVorbis));
|
@@ -358,6 +405,7 @@ ruby-taglib2 is a Ruby interface to TagLib, the audio meta-data library.
|
|
358
405
|
rb_define_alloc_func(cFile, file_alloc);
|
359
406
|
rb_define_method(cFile, "initialize", file_init, -1);
|
360
407
|
rb_define_method(cFile, "save", file_save, 0);
|
408
|
+
rb_define_method(cFile, "close", file_close, 0);
|
361
409
|
rb_define_method(cFile, "title", file_get_title, 0);
|
362
410
|
rb_define_method(cFile, "title=", file_set_title, 1);
|
363
411
|
rb_define_method(cFile, "artist", file_get_artist, 0);
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taglib2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Vincent Carmona
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
oxzIRXlS
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2011-
|
39
|
+
date: 2011-04-27 00:00:00 +02:00
|
40
40
|
default_executable:
|
41
41
|
dependencies: []
|
42
42
|
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- ChangeLog
|
57
57
|
- COPYING
|
58
58
|
- README
|
59
|
+
- Rakefile
|
59
60
|
has_rdoc: true
|
60
61
|
homepage: http://zik.rubyforge.org/ruby-taglib2
|
61
62
|
licenses:
|
metadata.gz.sig
CHANGED
Binary file
|