taglib2 0.1.4 → 0.1.5
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.tar.gz.sig +0 -0
- data/ChangeLog +6 -0
- data/Rakefile +1 -1
- data/compat/taglib.rb +1 -1
- data/lib/taglib2.rb +2 -2
- data/taglib2.c +2 -2
- data/tests/compat.rb +3 -5
- data/tests/constants.rb +2 -2
- data/tests/exceptions.rb +10 -10
- data/tests/file.rb +41 -38
- data/tests/tests.rb +17 -66
- metadata +6 -6
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
data/Rakefile
CHANGED
data/compat/taglib.rb
CHANGED
data/lib/taglib2.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010 Vincent Carmona
|
2
|
+
Copyright 2010-2012 Vincent Carmona
|
3
3
|
vinc4mai+taglib@gmail.com
|
4
4
|
|
5
5
|
This file is part of ruby-taglib2.
|
@@ -23,5 +23,5 @@ require "taglib2.so"
|
|
23
23
|
|
24
24
|
#:main: TagLib::File
|
25
25
|
module TagLib
|
26
|
-
VERSION=[0, 1,
|
26
|
+
VERSION=[0, 1, 5]
|
27
27
|
end
|
data/taglib2.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2012 Vincent Carmona
|
3
3
|
vinc4mai+taglib@gmail.com
|
4
4
|
|
5
5
|
This file is part of ruby-taglib2.
|
@@ -121,7 +121,7 @@ file_init(int argc, VALUE* argv, VALUE self)
|
|
121
121
|
}
|
122
122
|
else
|
123
123
|
{
|
124
|
-
taglib_file_new_type(StringValuePtr(path), NUM2INT(type));
|
124
|
+
tgFile=taglib_file_new_type(StringValuePtr(path), NUM2INT(type));
|
125
125
|
}
|
126
126
|
if (tgFile==NULL)
|
127
127
|
rb_raise(eBadFile, "Bad file");
|
data/tests/compat.rb
CHANGED
@@ -19,10 +19,8 @@ This file is part of ruby-taglib2.
|
|
19
19
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
20
20
|
=end
|
21
21
|
|
22
|
-
class
|
23
|
-
|
24
|
-
|
25
|
-
def test_badpath_new
|
26
|
-
assert_nothing_raised{TagLib::BadPath.new}
|
22
|
+
class BadPathTest < MiniTest::Unit::TestCase
|
23
|
+
def test_raise
|
24
|
+
assert_raises(TagLib::BadPath){raise TagLib::BadPath}
|
27
25
|
end
|
28
26
|
end
|
data/tests/constants.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2012 Vincent Carmona
|
3
3
|
vinc4mai+taglib@gmail.com
|
4
4
|
|
5
5
|
This file is part of ruby-taglib2.
|
@@ -19,7 +19,7 @@ This file is part of ruby-taglib2.
|
|
19
19
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
20
20
|
=end
|
21
21
|
|
22
|
-
class ConstantsTest <
|
22
|
+
class ConstantsTest < MiniTest::Unit::TestCase
|
23
23
|
def test_mpeg
|
24
24
|
assert_instance_of(Fixnum, TagLib::MPEG)
|
25
25
|
end
|
data/tests/exceptions.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2012 Vincent Carmona
|
3
3
|
vinc4mai+taglib@gmail.com
|
4
4
|
|
5
5
|
This file is part of ruby-taglib2.
|
@@ -19,20 +19,20 @@ This file is part of ruby-taglib2.
|
|
19
19
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
20
20
|
=end
|
21
21
|
|
22
|
-
class BadFileTest <
|
23
|
-
def
|
24
|
-
|
22
|
+
class BadFileTest < MiniTest::Unit::TestCase
|
23
|
+
def test_raise
|
24
|
+
assert_raises(TagLib::BadFile){raise TagLib::BadFile}
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
class BadTagTest <
|
29
|
-
def
|
30
|
-
|
28
|
+
class BadTagTest < MiniTest::Unit::TestCase
|
29
|
+
def test_raise
|
30
|
+
assert_raises(TagLib::BadTag){raise TagLib::BadTag}
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
class BadAudioPropertiesTest <
|
35
|
-
def
|
36
|
-
|
34
|
+
class BadAudioPropertiesTest < MiniTest::Unit::TestCase
|
35
|
+
def test_raise
|
36
|
+
assert_raises(TagLib::BadAudioProperties){raise TagLib::BadAudioProperties}
|
37
37
|
end
|
38
38
|
end
|
data/tests/file.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2012 Vincent Carmona
|
3
3
|
vinc4mai+taglib@gmail.com
|
4
4
|
|
5
5
|
This file is part of ruby-taglib2.
|
@@ -19,47 +19,50 @@ This file is part of ruby-taglib2.
|
|
19
19
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
20
20
|
=end
|
21
21
|
|
22
|
-
class
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
22
|
+
class TagLibFileTest < MiniTest::Unit::TestCase
|
23
|
+
dir=File.expand_path(File.dirname(__FILE__))
|
24
|
+
tmp=File.join(dir, 'tmp')
|
25
|
+
data=File.join(dir, 'data')
|
26
|
+
READ=File.join(tmp, 'read.wav')
|
27
|
+
EMPTY=File.join(tmp, 'empty')
|
28
|
+
WRITE=File.join(tmp, 'write.wav')
|
29
|
+
EXCEPTIONS=File.join(tmp, 'exceptions.ogg')
|
30
|
+
|
31
|
+
FileUtils.mkdir(tmp)
|
32
|
+
FileUtils.copy(File.join(data, 'silence.wav'), READ)
|
33
|
+
FileUtils.copy(File.join(data, 'empty'), EMPTY)
|
34
|
+
FileUtils.copy(File.join(data, 'silence.wav'), WRITE)
|
35
|
+
FileUtils.copy(File.join(data, 'exceptions.ogg'), EXCEPTIONS)
|
36
|
+
|
37
|
+
MiniTest::Unit.after_tests{FileUtils.remove_entry_secure(tmp)}
|
39
38
|
|
40
39
|
def test_new
|
41
|
-
|
40
|
+
assert_instance_of(TagLib::File, TagLib::File.new(READ))
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_new2
|
44
|
+
assert_instance_of(TagLib::File, TagLib::File.new(READ, TagLib::OggVorbis))
|
42
45
|
end
|
43
46
|
|
44
47
|
def test_badfile
|
45
|
-
|
48
|
+
assert_raises(TagLib::BadFile){TagLib::File.new(EMPTY)}
|
46
49
|
end
|
47
50
|
|
48
51
|
def test_badtag
|
49
|
-
|
50
|
-
f=TagLib::File.new(
|
52
|
+
assert_raises(TagLib::BadTag){
|
53
|
+
f=TagLib::File.new(EXCEPTIONS)
|
51
54
|
f.title
|
52
55
|
}
|
53
56
|
end
|
54
57
|
|
55
58
|
def test_badaudio
|
56
|
-
|
57
|
-
f=TagLib::File.new(
|
59
|
+
assert_raises(TagLib::BadAudioProperties){
|
60
|
+
f=TagLib::File.new(EXCEPTIONS)
|
58
61
|
f.length
|
59
62
|
}
|
60
63
|
end
|
61
64
|
|
62
|
-
def
|
65
|
+
def check_tag(file, tag)
|
63
66
|
assert_equal(tag[:title], file.title)
|
64
67
|
assert_equal(tag[:artist], file.artist)
|
65
68
|
assert_equal(tag[:album], file.album)
|
@@ -69,18 +72,20 @@ class TLFileTest < Test::Unit::TestCase
|
|
69
72
|
assert_equal(tag[:track], file.track)
|
70
73
|
end
|
71
74
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
+
|
76
|
+
def test_readtag
|
77
|
+
f=TagLib::File.new(READ)
|
78
|
+
check_tag(f, {:title=>'Title', :artist=>'Artist', :album=>'Album',
|
75
79
|
:comment=>'Comment', :genre=>'Genre', :year=>2010, :track=>12})
|
76
|
-
|
77
|
-
assert_equal(
|
80
|
+
assert_equal(3, f.length)
|
81
|
+
assert_equal(64, f.bitrate)
|
78
82
|
assert_equal(8000, f.samplerate)
|
79
83
|
assert_equal(1, f.channels)
|
80
84
|
end
|
81
85
|
|
82
86
|
def test_write
|
83
|
-
f=TagLib::File.new(
|
87
|
+
f=TagLib::File.new(WRITE)
|
88
|
+
assert_instance_of(TagLib::File, f)
|
84
89
|
f.title="title"
|
85
90
|
f.artist="artist"
|
86
91
|
f.album="album"
|
@@ -88,16 +93,14 @@ class TLFileTest < Test::Unit::TestCase
|
|
88
93
|
f.genre="genre"
|
89
94
|
f.year=1020
|
90
95
|
f.track=21
|
91
|
-
f.save
|
92
|
-
|
96
|
+
assert_equal(true, f.save)
|
97
|
+
check_tag(TagLib::File.new(WRITE), {:title=>'title', :artist=>'artist',
|
93
98
|
:album=>'album', :comment=>'comment', :genre=>'genre',
|
94
99
|
:year=>1020, :track=>21})
|
95
100
|
end
|
96
|
-
|
101
|
+
|
97
102
|
def test_close
|
98
|
-
|
99
|
-
|
100
|
-
f.close
|
101
|
-
}
|
103
|
+
f=TagLib::File.new(READ)
|
104
|
+
assert_equal(f, f.close)
|
102
105
|
end
|
103
106
|
end
|
data/tests/tests.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright 2010-
|
2
|
+
Copyright 2010-2012 Vincent Carmona
|
3
3
|
vinc4mai+taglib@gmail.com
|
4
4
|
|
5
5
|
This file is part of ruby-taglib2.
|
@@ -19,79 +19,30 @@ This file is part of ruby-taglib2.
|
|
19
19
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
20
20
|
=end
|
21
21
|
|
22
|
-
require
|
23
|
-
require '
|
22
|
+
require 'fileutils'
|
23
|
+
require 'minitest/autorun'
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
old_testunit_run_for_taglib2(result, &progress_block)
|
30
|
-
teardown if respond_to?(:teardown)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class TaglibTestsUtil
|
35
|
-
dir=File.expand_path(File.dirname(__FILE__))
|
36
|
-
@@tmp=File.join(dir, 'tmp')
|
37
|
-
@@read=File.join(@@tmp, 'read.wav')
|
38
|
-
@@empty=File.join(@@tmp, 'empty')
|
39
|
-
@@write=File.join(@@tmp, 'write.wav')
|
40
|
-
@@exceptions=File.join(@@tmp, 'exceptions.ogg')
|
41
|
-
|
42
|
-
def TaglibTestsUtil.tmp
|
43
|
-
@@tmp
|
44
|
-
end
|
45
|
-
|
46
|
-
def TaglibTestsUtil.read
|
47
|
-
@@read
|
48
|
-
end
|
49
|
-
|
50
|
-
def TaglibTestsUtil.empty
|
51
|
-
@@empty
|
52
|
-
end
|
53
|
-
|
54
|
-
def TaglibTestsUtil.write
|
55
|
-
@@write
|
56
|
-
end
|
57
|
-
|
58
|
-
def TaglibTestsUtil.exceptions
|
59
|
-
@@exceptions
|
60
|
-
end
|
61
|
-
|
62
|
-
def TaglibTestsUtil.clean
|
63
|
-
if File.exists?(@@tmp)
|
64
|
-
File.delete(*Dir.glob(File.join(@@tmp, '*')))
|
65
|
-
Dir.rmdir(@@tmp)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def TaglibTestsUtil.setup
|
70
|
-
data=File.join(@@tmp, '..', 'data')
|
71
|
-
TaglibTestsUtil.clean
|
72
|
-
File.makedirs(@@tmp)
|
73
|
-
File.copy(File.join(data, 'silence.wav'), @@read)
|
74
|
-
File.copy(File.join(data, 'empty'), @@empty)
|
75
|
-
File.copy(File.join(data, 'silence.wav'), @@write)
|
76
|
-
File.copy(File.join(data, 'exceptions.ogg'), @@exceptions)
|
77
|
-
end
|
78
|
-
|
79
|
-
def TaglibTestsUtil.teardown
|
80
|
-
TaglibTestsUtil.clean
|
81
|
-
end
|
25
|
+
compat=false
|
26
|
+
if ARGV.include?('--compat')
|
27
|
+
ARGV.delete('--compat')
|
28
|
+
compat=true
|
82
29
|
end
|
83
30
|
|
84
31
|
dir=File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
85
32
|
$:.unshift(dir)
|
86
33
|
$:.unshift(File.join(dir, 'lib'))
|
87
|
-
if
|
88
|
-
ARGV.delete('--compat')
|
34
|
+
if compat
|
89
35
|
$:.unshift(File.join(dir, 'compat'))
|
90
36
|
require 'taglib'
|
91
|
-
require 'tests/compat'
|
92
37
|
else
|
93
38
|
require "taglib2"
|
94
39
|
end
|
95
|
-
|
96
|
-
|
97
|
-
|
40
|
+
puts "taglib2 version #{TagLib::VERSION.join('.')}"
|
41
|
+
|
42
|
+
tests=%w(constants exceptions file)
|
43
|
+
tests << "compat" if compat
|
44
|
+
if Kernel.respond_to? :require_relative
|
45
|
+
tests.each{|test| require_relative test}
|
46
|
+
else#DEPRECATED: ruby1.8
|
47
|
+
tests.each{|test| require File.join(dir, 'tests', test)}
|
48
|
+
end
|
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: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
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: 2012-
|
39
|
+
date: 2012-02-20 00:00:00 Z
|
40
40
|
dependencies: []
|
41
41
|
|
42
42
|
description:
|
@@ -52,12 +52,12 @@ files:
|
|
52
52
|
- compat/taglib.rb
|
53
53
|
- taglib2.c
|
54
54
|
- extconf.rb
|
55
|
-
- tests/data/silence.wav
|
56
55
|
- tests/data/empty
|
57
56
|
- tests/data/exceptions.ogg
|
57
|
+
- tests/data/silence.wav
|
58
58
|
- tests/tests.rb
|
59
|
-
- tests/exceptions.rb
|
60
59
|
- tests/constants.rb
|
60
|
+
- tests/exceptions.rb
|
61
61
|
- tests/file.rb
|
62
62
|
- tests/compat.rb
|
63
63
|
- ChangeLog
|
metadata.gz.sig
CHANGED
Binary file
|