taglib2 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- U�?�f����%�B�#�e��i(Tn���[Q�&���[e?��_K��� :�Ƃ{���$�N|�Ը��aRxz,�s��d}Go�$fG�������FKU2VoC2|K��n=��
2
- _�LN�)+m���y3w���O��SHҀO��l4DWz i�# i�~8�ی*v�sqU%z�{@3�i9�E<a�U�h�7�v�r `IF+�(�;�D�g�P�T�
1
+ �w��٩�M�Ye������ ��;z8�Dcګu��FӋ��f�$hVdg8Pܑ���T�����0�����<µF��[��G@���������\X��<'���'%�k�K���f}Ics�&�q��pf�g���b�J�j@Iw�}�\��}&*��t]E-�������
2
+ _�����CO��*�\ꗜh����~�-�`h�#�;�'/u9fTm�K{[�&�H;�s�&2�� +�2�_WN=�i�@����
data/ChangeLog CHANGED
@@ -1,3 +1,5 @@
1
+ Add tests files in gem package
2
+
1
3
  # 0.1.3
2
4
  Add File#close methods
3
5
  Add Rakefile file to gem package
data/Rakefile CHANGED
@@ -75,6 +75,7 @@ begin
75
75
  require 'rake/gempackagetask.rb'
76
76
 
77
77
  files=FileList['lib/**/*.rb', "compat/taglib.rb", '*.h', '*.c', 'extconf.rb',
78
+ 'tests/**/*',
78
79
  'ChangeLog', 'COPYING', 'README', 'Rakefile']
79
80
  ext=FileList["extconf.rb"]
80
81
  rdoc_options=["taglib2.c"]
data/lib/taglib2.rb CHANGED
@@ -23,5 +23,5 @@ require "taglib2.so"
23
23
 
24
24
  #:main: TagLib::File
25
25
  module TagLib
26
- VERSION=[0, 1, 3]
26
+ VERSION=[0, 1, 4]
27
27
  end
data/taglib2.c CHANGED
@@ -95,7 +95,7 @@ file_alloc(VALUE self)
95
95
  data=ALLOC(tgFileData);
96
96
  data->tag=NULL;
97
97
  data->audio=NULL;
98
- data->closed=0;
98
+ data->closed=1;
99
99
  return Data_Wrap_Struct(self, 0, free_tgFileData, data);
100
100
  }
101
101
 
@@ -125,8 +125,8 @@ file_init(int argc, VALUE* argv, VALUE self)
125
125
  }
126
126
  if (tgFile==NULL)
127
127
  rb_raise(eBadFile, "Bad file");
128
-
129
128
  Data_Get_Struct(self, tgFileData, data);
129
+ data->closed=0;
130
130
  data->file=tgFile;
131
131
  rb_iv_set(self, "@path", path);
132
132
  rb_iv_set(self, "@type", type);
data/tests/compat.rb ADDED
@@ -0,0 +1,28 @@
1
+ =begin
2
+ Copyright 2010-2011 Vincent Carmona
3
+ vinc4mai+taglib@gmail.com
4
+
5
+ This file is part of ruby-taglib2.
6
+
7
+ ruby-taglib2 is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation; either version 2 of the License, or
10
+ (at your option) any later version.
11
+
12
+ ruby-taglib2 is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with ruby-taglib2; if not, write to the Free Software
19
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ =end
21
+
22
+ class CompatTest < Test::Unit::TestCase
23
+ @@read=TaglibTestsUtil.read
24
+
25
+ def test_badpath_new
26
+ assert_nothing_raised{TagLib::BadPath.new}
27
+ end
28
+ end
@@ -0,0 +1,62 @@
1
+ =begin
2
+ Copyright 2010-2011 Vincent Carmona
3
+ vinc4mai+taglib@gmail.com
4
+
5
+ This file is part of ruby-taglib2.
6
+
7
+ ruby-taglib2 is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation; either version 2 of the License, or
10
+ (at your option) any later version.
11
+
12
+ ruby-taglib2 is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with ruby-taglib2; if not, write to the Free Software
19
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ =end
21
+
22
+ class ConstantsTest < Test::Unit::TestCase
23
+ def test_mpeg
24
+ assert_instance_of(Fixnum, TagLib::MPEG)
25
+ end
26
+
27
+ def test_oggvorbis
28
+ assert_instance_of(Fixnum, TagLib::OggVorbis)
29
+ end
30
+
31
+ def test_flac
32
+ assert_instance_of(Fixnum, TagLib::FLAC)
33
+ end
34
+
35
+ def test_mpc
36
+ assert_instance_of(Fixnum, TagLib::MPC)
37
+ end
38
+
39
+ def test_oggflac
40
+ assert_instance_of(Fixnum, TagLib::OggFlac)
41
+ end
42
+
43
+ def test_wavpack
44
+ assert_instance_of(Fixnum, TagLib::WavPack)
45
+ end
46
+
47
+ def test_speex
48
+ assert_instance_of(Fixnum, TagLib::Speex)
49
+ end
50
+
51
+ def test_trueaudio
52
+ assert_instance_of(Fixnum, TagLib::TrueAudio)
53
+ end
54
+
55
+ def test_mp4
56
+ assert_instance_of(Fixnum, TagLib::MP4)
57
+ end
58
+
59
+ def test_asf
60
+ assert_instance_of(Fixnum, TagLib::ASF)
61
+ end
62
+ end
data/tests/data/empty ADDED
File without changes
Binary file
Binary file
@@ -0,0 +1,38 @@
1
+ =begin
2
+ Copyright 2010-2011 Vincent Carmona
3
+ vinc4mai+taglib@gmail.com
4
+
5
+ This file is part of ruby-taglib2.
6
+
7
+ ruby-taglib2 is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation; either version 2 of the License, or
10
+ (at your option) any later version.
11
+
12
+ ruby-taglib2 is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with ruby-taglib2; if not, write to the Free Software
19
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ =end
21
+
22
+ class BadFileTest < Test::Unit::TestCase
23
+ def test_new
24
+ assert_nothing_raised{TagLib::BadFile.new}
25
+ end
26
+ end
27
+
28
+ class BadTagTest < Test::Unit::TestCase
29
+ def test_new
30
+ assert_nothing_raised{TagLib::BadTag.new}
31
+ end
32
+ end
33
+
34
+ class BadAudioPropertiesTest < Test::Unit::TestCase
35
+ def test_new
36
+ assert_nothing_raised{TagLib::BadAudioProperties.new}
37
+ end
38
+ end
data/tests/file.rb ADDED
@@ -0,0 +1,103 @@
1
+ =begin
2
+ Copyright 2010-2011 Vincent Carmona
3
+ vinc4mai+taglib@gmail.com
4
+
5
+ This file is part of ruby-taglib2.
6
+
7
+ ruby-taglib2 is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation; either version 2 of the License, or
10
+ (at your option) any later version.
11
+
12
+ ruby-taglib2 is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with ruby-taglib2; if not, write to the Free Software
19
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ =end
21
+
22
+ class TLFileTest < Test::Unit::TestCase
23
+ @@tmp=TaglibTestsUtil.tmp
24
+ @@read=TaglibTestsUtil.read
25
+ @@empty=TaglibTestsUtil.empty
26
+ @@write=TaglibTestsUtil.write
27
+ @@exceptions=TaglibTestsUtil.exceptions
28
+
29
+ def TLFileTest.suite
30
+ suite=super
31
+ def suite.setup
32
+ TaglibTestsUtil.setup
33
+ end
34
+ def suite.teardown
35
+ TaglibTestsUtil.teardown
36
+ end
37
+ suite
38
+ end
39
+
40
+ def test_new
41
+ assert_nothing_raised{TagLib::File.new(@@read)}
42
+ end
43
+
44
+ def test_badfile
45
+ assert_raise(TagLib::BadFile){TagLib::File.new(@@empty)}
46
+ end
47
+
48
+ def test_badtag
49
+ assert_raise(TagLib::BadTag){
50
+ f=TagLib::File.new(@@exceptions)
51
+ f.title
52
+ }
53
+ end
54
+
55
+ def test_badaudio
56
+ assert_raise(TagLib::BadAudioProperties){
57
+ f=TagLib::File.new(@@exceptions)
58
+ f.length
59
+ }
60
+ end
61
+
62
+ def read_tag(file, tag)
63
+ assert_equal(tag[:title], file.title)
64
+ assert_equal(tag[:artist], file.artist)
65
+ assert_equal(tag[:album], file.album)
66
+ assert_equal(tag[:comment], file.comment)
67
+ assert_equal(tag[:genre], file.genre)
68
+ assert_equal(tag[:year], file.year)
69
+ assert_equal(tag[:track], file.track)
70
+ end
71
+
72
+ def test_read
73
+ f=TagLib::File.new(@@read)
74
+ read_tag(f, {:title=>'Title', :artist=>'Artist', :album=>'Album',
75
+ :comment=>'Comment', :genre=>'Genre', :year=>2010, :track=>12})
76
+ # assert_equal(, f.length)
77
+ assert_equal(62, f.bitrate)
78
+ assert_equal(8000, f.samplerate)
79
+ assert_equal(1, f.channels)
80
+ end
81
+
82
+ def test_write
83
+ f=TagLib::File.new(@@write)
84
+ f.title="title"
85
+ f.artist="artist"
86
+ f.album="album"
87
+ f.comment="comment"
88
+ f.genre="genre"
89
+ f.year=1020
90
+ f.track=21
91
+ f.save
92
+ read_tag(TagLib::File.new(@@write), {:title=>'title', :artist=>'artist',
93
+ :album=>'album', :comment=>'comment', :genre=>'genre',
94
+ :year=>1020, :track=>21})
95
+ end
96
+
97
+ def test_close
98
+ assert_nothing_raised{
99
+ f=TagLib::File.new(@@read)
100
+ f.close
101
+ }
102
+ end
103
+ end
data/tests/tests.rb ADDED
@@ -0,0 +1,97 @@
1
+ =begin
2
+ Copyright 2010-2011 Vincent Carmona
3
+ vinc4mai+taglib@gmail.com
4
+
5
+ This file is part of ruby-taglib2.
6
+
7
+ ruby-taglib2 is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation; either version 2 of the License, or
10
+ (at your option) any later version.
11
+
12
+ ruby-taglib2 is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with ruby-taglib2; if not, write to the Free Software
19
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ =end
21
+
22
+ require "test/unit"
23
+ require 'ftools'
24
+
25
+ class Test::Unit::TestSuite
26
+ alias :old_testunit_run_for_taglib2 :run
27
+ def run(result, &progress_block)
28
+ setup if respond_to?(:setup)
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
82
+ end
83
+
84
+ dir=File.expand_path(File.join(File.dirname(__FILE__), ".."))
85
+ $:.unshift(dir)
86
+ $:.unshift(File.join(dir, 'lib'))
87
+ if ARGV.include?('--compat')
88
+ ARGV.delete('--compat')
89
+ $:.unshift(File.join(dir, 'compat'))
90
+ require 'taglib'
91
+ require 'tests/compat'
92
+ else
93
+ require "taglib2"
94
+ end
95
+ require 'tests/constants'
96
+ require 'tests/exceptions'
97
+ require 'tests/file'
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: 29
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vincent Carmona
@@ -36,8 +36,7 @@ cert_chain:
36
36
  oxzIRXlS
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-04-27 00:00:00 +02:00
40
- default_executable:
39
+ date: 2012-01-21 00:00:00 Z
41
40
  dependencies: []
42
41
 
43
42
  description:
@@ -53,11 +52,18 @@ files:
53
52
  - compat/taglib.rb
54
53
  - taglib2.c
55
54
  - extconf.rb
55
+ - tests/data/silence.wav
56
+ - tests/data/empty
57
+ - tests/data/exceptions.ogg
58
+ - tests/tests.rb
59
+ - tests/exceptions.rb
60
+ - tests/constants.rb
61
+ - tests/file.rb
62
+ - tests/compat.rb
56
63
  - ChangeLog
57
64
  - COPYING
58
65
  - README
59
66
  - Rakefile
60
- has_rdoc: true
61
67
  homepage: http://zik.rubyforge.org/ruby-taglib2
62
68
  licenses:
63
69
  - General Public License v2
@@ -87,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
93
  requirements: []
88
94
 
89
95
  rubyforge_project: zik
90
- rubygems_version: 1.3.7
96
+ rubygems_version: 1.7.2
91
97
  signing_key:
92
98
  specification_version: 3
93
99
  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.
metadata.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- ,V�$�4'��� F�����C�&4�ښ98����#�.�G�=ǥ�R-��|?���^XW6x�"x�$c2pD}X�^�"���$ ��P��WŃ����qTtآ� ��6t�pZLW^��s�%��2����J.A
2
- �~�;V�r��(ޢ
3
- �?F�k3�R�h��j�{�������m�D��V�Q\<QV$4% 9���SW� �"P`HYZ��J�F[_d0�
1
+ w��������u|:�LmvtQFQrWl�"�����0��@`!d!�w����#,f��5��T oj�A�z��i����]?m��~hl�z{�3��j6�n!�.q��
2
+ ���&> ���"c����z�/�����ӚNP����0HӬ����&C��
3
+ :����Pc�ș\��j���3g%��