rtaglib 0.2.0 → 0.2.1
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.
- data/History.txt +4 -0
- data/Manifest.txt +4 -0
- data/Rakefile +8 -3
- data/ext/tagfile/tagfile.c +1 -1
- data/ext/taglib/extconf.rb +1 -1
- data/ext/taglib/taglib.cxx +4777 -820
- data/lib/TagLib.rb +2 -0
- data/lib/TagLib_doc.rb +2621 -0
- data/swig/Rakefile +25 -9
- data/swig/extconf.rb +1 -1
- data/swig/make_doc.rb +120 -0
- data/swig/process_cxx.rb +38 -0
- data/swig/taglib.i +31 -8
- data/swig/test.rb +27 -27
- data/test/test_taglib.rb +27 -27
- metadata +7 -2
data/test/test_taglib.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
if File.exists? File.dirname(__FILE__)+"/
|
3
|
-
require File.dirname(__FILE__)+'/
|
2
|
+
if File.exists? File.dirname(__FILE__)+"/TagLib.so"
|
3
|
+
require File.dirname(__FILE__)+'/TagLib'
|
4
4
|
BASE_DATA=File.dirname(__FILE__)+"/../test/data/"
|
5
5
|
else
|
6
|
-
require File.dirname(__FILE__)+'/../ext/taglib/
|
6
|
+
require File.dirname(__FILE__)+'/../ext/taglib/TagLib'
|
7
7
|
BASE_DATA=File.dirname(__FILE__)+"/data/"
|
8
8
|
end
|
9
9
|
require 'fileutils'
|
@@ -27,7 +27,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
27
27
|
FileUtils.copy(original, copy)
|
28
28
|
copy
|
29
29
|
end
|
30
|
-
#
|
30
|
+
# TagLib::File test for
|
31
31
|
# - writable?
|
32
32
|
# - open?
|
33
33
|
# - valid?
|
@@ -38,7 +38,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
38
38
|
def test_file
|
39
39
|
mp3=@data_dir+"440Hz-5sec.mp3"
|
40
40
|
copy=get_copy(mp3)
|
41
|
-
file=
|
41
|
+
file=TagLib::MPEG::File.new(mp3)
|
42
42
|
assert(file.writable?)
|
43
43
|
assert(file.open?)
|
44
44
|
assert(file.valid?)
|
@@ -48,7 +48,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
48
48
|
expected=sprintf("%c%c%c%c%c%c%c%c%c%c",0x54,0x49,0x54,0x32,0x00,0x00, 0x00,0x10,0x00,0x00)
|
49
49
|
assert_equal(expected,file.readBlock(10))
|
50
50
|
|
51
|
-
file.seek(-6,
|
51
|
+
file.seek(-6, TagLib::File::End)
|
52
52
|
expected=sprintf("%c%c%c%c%c%c",0x77,0x61,0x72,0x00,0x01,0x47)
|
53
53
|
assert_equal(expected,file.readBlock(6))
|
54
54
|
|
@@ -59,7 +59,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
59
59
|
assert_equal(0x7B46,file.length())
|
60
60
|
|
61
61
|
end
|
62
|
-
#
|
62
|
+
# TagLib::FileRef test for
|
63
63
|
# - ::defaultFileExtensions()
|
64
64
|
# - length
|
65
65
|
# - save
|
@@ -68,12 +68,12 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
68
68
|
# - isNull (null?)
|
69
69
|
def test_fileref
|
70
70
|
|
71
|
-
assert_equal(%w{ogg flac oga mp3 mpc wv spx tta},
|
71
|
+
assert_equal(%w{ogg flac oga mp3 mpc wv spx tta}, TagLib::FileRef.defaultFileExtensions())
|
72
72
|
bitrate={'flac'=>168,'wv'=>235,'mp3'=>48,'mpc'=>41,'ogg'=>80}
|
73
73
|
channels={'flac'=>1,'wv'=>1,'mp3'=>1,'mpc'=>2,'ogg'=>1}
|
74
74
|
|
75
75
|
Dir.glob(@data_dir+"/*").each{|f|
|
76
|
-
fr=
|
76
|
+
fr=TagLib::FileRef.new(f)
|
77
77
|
f=~/.+\.(.+)/
|
78
78
|
ext=$1
|
79
79
|
|
@@ -93,7 +93,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
93
93
|
}
|
94
94
|
mp3=@data_dir+"440Hz-5sec.mp3"
|
95
95
|
copy=get_copy(mp3)
|
96
|
-
fr2=
|
96
|
+
fr2=TagLib::FileRef.new(copy)
|
97
97
|
fr2.tag().title="new title";
|
98
98
|
fr2.tag().artist="new artist";
|
99
99
|
fr2.tag().album="new album";
|
@@ -106,7 +106,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
106
106
|
copy2=get_copy(copy)
|
107
107
|
fr2.tag().title="sfsd"
|
108
108
|
fr2.save()
|
109
|
-
fr3=
|
109
|
+
fr3=TagLib::FileRef.new(copy2)
|
110
110
|
assert_equal("new title",fr3.tag.title)
|
111
111
|
assert_equal("new artist",fr3.tag.artist)
|
112
112
|
assert_equal("new album",fr3.tag.album)
|
@@ -121,9 +121,9 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
121
121
|
copy_xiph=get_copy(original)
|
122
122
|
copy_id1=get_copy(original)
|
123
123
|
copy_id2=get_copy(original)
|
124
|
-
flac_xiph=
|
125
|
-
flac_id1=
|
126
|
-
flac_id2=
|
124
|
+
flac_xiph=TagLib::FLAC::File.new(copy_xiph,true)
|
125
|
+
flac_id1=TagLib::FLAC::File.new(copy_id1,true)
|
126
|
+
flac_id2=TagLib::FLAC::File.new(copy_id2,true)
|
127
127
|
|
128
128
|
# file
|
129
129
|
assert_equal(34,flac_xiph.streamInfoData.length)
|
@@ -165,17 +165,17 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
165
165
|
def test_mpeg
|
166
166
|
original=@data_dir+"440Hz-5sec.mp3"
|
167
167
|
copy=get_copy(original)
|
168
|
-
mp3=
|
168
|
+
mp3=TagLib::MPEG::File.new(copy)
|
169
169
|
%w{tag ID3v1Tag ID3v2Tag}.each {|f|
|
170
170
|
assert_equal("440Hz Sine Wave",mp3.send(f).title)
|
171
171
|
}
|
172
172
|
# file
|
173
173
|
# strip only id3v1
|
174
|
-
mp3.strip(
|
174
|
+
mp3.strip(TagLib::MPEG::File::ID3v1)
|
175
175
|
assert_nil(mp3.ID3v1Tag)
|
176
176
|
assert_not_nil(mp3.ID3v2Tag)
|
177
177
|
copy=get_copy(original)
|
178
|
-
mp3=
|
178
|
+
mp3=TagLib::MPEG::File.new(copy)
|
179
179
|
# strip all
|
180
180
|
mp3.strip()
|
181
181
|
assert_nil(mp3.ID3v1Tag)
|
@@ -186,7 +186,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
186
186
|
assert_equal(0,mp3.audioProperties.version)
|
187
187
|
assert_equal(3,mp3.audioProperties.layer)
|
188
188
|
assert(!mp3.audioProperties.protectionEnabled)
|
189
|
-
assert_equal(
|
189
|
+
assert_equal(TagLib::MPEG::Header::SingleChannel, mp3.audioProperties.channelMode)
|
190
190
|
assert(!mp3.audioProperties.isCopyrighted)
|
191
191
|
assert(mp3.audioProperties.isOriginal)
|
192
192
|
|
@@ -197,27 +197,27 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
197
197
|
def _test_mpc
|
198
198
|
original=@data_dir+"440Hz-5sec.mpc"
|
199
199
|
copy=get_copy(original)
|
200
|
-
fr=
|
200
|
+
fr=TagLib::FileRef.new(copy)
|
201
201
|
fr.tag.title="440Hz Sine Wave"
|
202
202
|
fr.save
|
203
|
-
mpc=
|
203
|
+
mpc=TagLib::MPEG_File.new(copy)
|
204
204
|
%w{tag APETag}.each {|f|
|
205
205
|
assert_equal("440Hz Sine Wave",mpc.send(f).title, "#{f} tag")
|
206
206
|
}
|
207
207
|
# file
|
208
208
|
# strip only id3v1
|
209
|
-
mpc.strip(
|
209
|
+
mpc.strip(TagLib::MPC_File::ID3v1)
|
210
210
|
mpc.save
|
211
|
-
mpc1=
|
211
|
+
mpc1=TagLib::MPEG_File.new(copy)
|
212
212
|
|
213
213
|
# assert_nil(mpc1.ID3v1Tag)
|
214
214
|
assert_not_nil(mpc1.APETag)
|
215
215
|
copy=get_copy(original)
|
216
|
-
mpc=
|
216
|
+
mpc=TagLib::MPC_File.new(copy)
|
217
217
|
# strip all
|
218
218
|
mpc.strip()
|
219
219
|
mpc.save
|
220
|
-
mpc1=
|
220
|
+
mpc1=TagLib::MPEG_File.new(copy)
|
221
221
|
|
222
222
|
# assert_nil(mpc1.ID3v1Tag)
|
223
223
|
assert_nil(mpc1.APETag)
|
@@ -227,7 +227,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
227
227
|
assert_equal(0,mp3.audioProperties.version)
|
228
228
|
assert_equal(3,mp3.audioProperties.layer)
|
229
229
|
assert(!mp3.audioProperties.protectionEnabled)
|
230
|
-
assert_equal(
|
230
|
+
assert_equal(TagLib::MPEG_Header::SingleChannel, mp3.audioProperties.channelMode)
|
231
231
|
assert(!mp3.audioProperties.isCopyrighted)
|
232
232
|
assert(mp3.audioProperties.isOriginal)
|
233
233
|
|
@@ -238,7 +238,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
238
238
|
|
239
239
|
|
240
240
|
def test_fieldmap
|
241
|
-
fl=
|
241
|
+
fl=TagLib::FieldListMap.new()
|
242
242
|
fl.insert("key",["val1","val2"])
|
243
243
|
assert_equal(["val1","val2"],fl["key"])
|
244
244
|
assert_nil(fl["2"])
|
@@ -249,7 +249,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
249
249
|
def test_xiph_comment
|
250
250
|
original=@data_dir+"440Hz-5sec.flac"
|
251
251
|
copy_xiph=get_copy(original)
|
252
|
-
flac_xiph=
|
252
|
+
flac_xiph=TagLib::FLAC::File.new(copy_xiph,true)
|
253
253
|
xc=flac_xiph.xiphComment
|
254
254
|
fl=xc.fieldListMap
|
255
255
|
fl.hash.each {|k,v|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtaglib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Bustos
|
@@ -9,7 +9,7 @@ autorequire: ""
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-11 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -43,8 +43,12 @@ files:
|
|
43
43
|
- ext/tagfile/tagfile.c
|
44
44
|
- ext/taglib/extconf.rb
|
45
45
|
- ext/taglib/taglib.cxx
|
46
|
+
- lib/TagLib.rb
|
47
|
+
- lib/TagLib_doc.rb
|
46
48
|
- swig/Rakefile
|
47
49
|
- swig/extconf.rb
|
50
|
+
- swig/make_doc.rb
|
51
|
+
- swig/process_cxx.rb
|
48
52
|
- swig/taglib.i
|
49
53
|
- swig/test.rb
|
50
54
|
- test/data/440Hz-5sec.flac
|
@@ -62,6 +66,7 @@ rdoc_options:
|
|
62
66
|
- --main
|
63
67
|
- README.txt
|
64
68
|
require_paths:
|
69
|
+
- lib
|
65
70
|
- ext
|
66
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
72
|
requirements:
|