rtaglib 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- 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/swig/Rakefile
CHANGED
@@ -6,28 +6,44 @@ require 'rake/rdoctask'
|
|
6
6
|
|
7
7
|
task :default => [:compile,:test,:copy]
|
8
8
|
|
9
|
-
task :compile => ["
|
9
|
+
task :compile => ["TagLib.so"]
|
10
10
|
|
11
|
-
|
11
|
+
|
12
|
+
task :docs => ["TagLib_doc.rb"] do |t|
|
13
|
+
system %(rdoc -f html TagLib_doc.rb)
|
14
|
+
end
|
15
|
+
|
16
|
+
file "TagLib_doc.rb" => ["make_doc.rb","TagLib.so","xml"] do |t|
|
17
|
+
system %(ruby make_doc.rb)
|
18
|
+
end
|
19
|
+
file "xml" => ["Doxyfile"] do |t|
|
20
|
+
system %(doxygen)
|
21
|
+
end
|
22
|
+
task :test => ["TagLib.so"] do |t|
|
12
23
|
system %(ruby "test.rb")
|
13
24
|
end
|
14
|
-
task :copy => [:test] do |t|
|
25
|
+
task :copy => [:test, :docs] do |t|
|
15
26
|
system %(cp extconf.rb taglib.cxx ../ext/taglib/)
|
16
27
|
system %(cp test.rb ../test/test_taglib.rb)
|
28
|
+
system %(cp TagLib_doc.rb ../lib/)
|
29
|
+
|
17
30
|
end
|
18
|
-
file "
|
31
|
+
file "TagLib.so" => ["taglib.cxx","Makefile"] do |t|
|
19
32
|
system %(make)
|
20
33
|
end
|
21
34
|
|
22
|
-
file "
|
35
|
+
file "Makefile" => ["extconf.rb"] do |t|
|
36
|
+
system %(ruby extconf.rb)
|
37
|
+
end
|
38
|
+
file "taglib.cxx" => ["taglib.i", "process_cxx.rb"] do |t|
|
23
39
|
puts "Actualizando swig"
|
24
40
|
if
|
25
|
-
!system %(swig -fvirtual -Wall -c++ -o
|
41
|
+
!system %(swig -fvirtual -Wall -c++ -o pre_taglib -ruby taglib.i)
|
26
42
|
system %(rm *.o *.so *.cxx)
|
27
43
|
end
|
44
|
+
system %(ruby process_cxx.rb)
|
28
45
|
end
|
29
46
|
|
30
|
-
|
31
|
-
system %(
|
47
|
+
task :clean =>[] do |t|
|
48
|
+
system %(rm *.o *.so *.cxx *~ Makefile)
|
32
49
|
end
|
33
|
-
|
data/swig/extconf.rb
CHANGED
data/swig/make_doc.rb
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#### Make docs
|
3
|
+
require 'rexml/document'
|
4
|
+
df=Object.methods
|
5
|
+
|
6
|
+
require 'TagLib'
|
7
|
+
fo=File.open("TagLib_doc.rb","wb")
|
8
|
+
|
9
|
+
def data_method(fm)
|
10
|
+
if !fm.nil?
|
11
|
+
brief_desc=fm[:brief_desc].gsub(/\s+/im,"").size>0 ? "<b>#{fm[:brief_desc]}</b>\n":""
|
12
|
+
desc=(" # "+brief_desc+fm[:long_desc]+"\n").gsub("\n","\n # ")+"\n"
|
13
|
+
params=fm[:param].join(",")
|
14
|
+
else
|
15
|
+
desc=""
|
16
|
+
params=""
|
17
|
+
end
|
18
|
+
{:desc=>desc,:params=>params}
|
19
|
+
end
|
20
|
+
|
21
|
+
def print_methods(klass,functions,indent)
|
22
|
+
out=""
|
23
|
+
methods=klass.singleton_methods-Object.singleton_methods
|
24
|
+
#p functions
|
25
|
+
if(methods.size>0)
|
26
|
+
out << indent+"# Singleton methods\n"
|
27
|
+
methods.each{|m|
|
28
|
+
dm=data_method(functions[m])
|
29
|
+
out << dm[:desc]+indent+"def self.#{m}(#{dm[:params]})\n"+indent+"end\n"
|
30
|
+
}
|
31
|
+
end
|
32
|
+
methods=klass.instance_methods-Object.instance_methods
|
33
|
+
methods.each{|m|
|
34
|
+
dm=data_method(functions[m])
|
35
|
+
|
36
|
+
out << dm[:desc]+indent+"def #{m}(#{dm[:params]})\n"+indent+"end\n"
|
37
|
+
}
|
38
|
+
out
|
39
|
+
end
|
40
|
+
def get_doxygen_description(xml_file)
|
41
|
+
out=""
|
42
|
+
funcs={}
|
43
|
+
if(File.exists? xml_file)
|
44
|
+
#p xml_file
|
45
|
+
xml=REXML::Document.new(File.new(xml_file))
|
46
|
+
short_desc=xml.root.elements["/doxygen/compounddef/briefdescription"].to_s.gsub(/<.+?>/,"")
|
47
|
+
long_desc=xml.root.elements["/doxygen/compounddef/detaileddescription"].to_s.gsub(/<.+?>/,"")
|
48
|
+
out+=" # "+("<b>"+short_desc+".</b>\n\n"+long_desc).gsub("\n","\n # ")
|
49
|
+
out+="\n # \n"
|
50
|
+
# functions
|
51
|
+
xml.elements.each("/doxygen/compounddef/sectiondef[@kind='public-func']/memberdef[@kind='function']") {|func|
|
52
|
+
|
53
|
+
name=func.elements["name"].text
|
54
|
+
brief=func.elements["briefdescription"].to_s.gsub(/<.+?>/,"")
|
55
|
+
long=func.elements["detaileddescription"].to_s.gsub(/<.+?>/,"")
|
56
|
+
|
57
|
+
param=[]
|
58
|
+
func.elements.each("param") {|xpar|
|
59
|
+
type=xpar.elements["type"].to_s.gsub(/<.+?>|const|\*|String|StringList|&/,"").chomp
|
60
|
+
if xpar.elements["defval"]
|
61
|
+
param.push(type+" "+xpar.elements["declname"].text+" = "+xpar.elements["defval"].to_s.gsub(/<.+?>/,""))
|
62
|
+
else
|
63
|
+
param.push(type+" "+xpar.elements["declname"].text)
|
64
|
+
end
|
65
|
+
}
|
66
|
+
funcs[name]={:param=>param,:brief_desc=>brief,:long_desc=>long}
|
67
|
+
}
|
68
|
+
end
|
69
|
+
{:object=>out,:functions=>funcs}
|
70
|
+
end
|
71
|
+
def print_class(klass,indent)
|
72
|
+
out=""
|
73
|
+
xml_file="xml/xml/class"+klass.to_s.gsub(":","_1")+".xml"
|
74
|
+
dd=get_doxygen_description(xml_file)
|
75
|
+
out+=dd[:object]
|
76
|
+
#p dd[:functions]
|
77
|
+
if klass.superclass != Object
|
78
|
+
out+=indent+"class #{klass} < "+klass.superclass.to_s+"\n"
|
79
|
+
else
|
80
|
+
out+=indent+"class #{klass}\n"
|
81
|
+
end
|
82
|
+
out+=print_methods(klass,dd[:functions],indent+" ")
|
83
|
+
out << indent+"end\n"
|
84
|
+
end
|
85
|
+
def print_module(mod,indent)
|
86
|
+
out=""
|
87
|
+
xml_file="xml/xml/namespace"+mod.to_s.gsub(":","_1")+".xml"
|
88
|
+
dd=get_doxygen_description(xml_file)
|
89
|
+
out+=dd[:object]
|
90
|
+
out+=indent+"module #{mod}\n"
|
91
|
+
out+=indent+print_methods(mod,dd[:functions],indent+" ")
|
92
|
+
submods=[]
|
93
|
+
mod.constants.each {|c|
|
94
|
+
if mod.const_get(c).class==Module
|
95
|
+
submods.push(c)
|
96
|
+
else
|
97
|
+
out << print_constant(mod,c,indent+" ")
|
98
|
+
end
|
99
|
+
}
|
100
|
+
submods.each{|sm|
|
101
|
+
out << print_constant(mod,sm,indent+" ")
|
102
|
+
}
|
103
|
+
out << indent+"end\n"
|
104
|
+
out
|
105
|
+
end
|
106
|
+
def print_constant(obj,con,indent)
|
107
|
+
out=""
|
108
|
+
if(obj.const_get(con).class==Module)
|
109
|
+
out+=print_module(obj.const_get(con),indent+" ")
|
110
|
+
elsif(obj.const_get(con).class==Class)
|
111
|
+
out+=print_class(obj.const_get(con),indent)
|
112
|
+
else
|
113
|
+
out+=indent+"#{con}="+obj.const_get(con).to_s+"\n"
|
114
|
+
end
|
115
|
+
out
|
116
|
+
end
|
117
|
+
out=""
|
118
|
+
out=print_constant(ObjectSpace,"TagLib","")
|
119
|
+
fo.puts out
|
120
|
+
fo.close
|
data/swig/process_cxx.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'fileutils'
|
3
|
+
file="pre_taglib"
|
4
|
+
out="taglib.cxx"
|
5
|
+
fo=File.open(out,"wb")
|
6
|
+
swig_p={}
|
7
|
+
File.open(file,"r") {|f| f.each_line {|l|
|
8
|
+
l.gsub!("SWIGINTERN VALUE","VALUE")
|
9
|
+
if(l=~/SWIG_TypeClientData\((.+),\s*\(void \*\) &(.+)\);/)
|
10
|
+
swig_p[$1]=$2
|
11
|
+
end
|
12
|
+
if(l=~/\s+(.+) = rb_define_class_under\(mTagLib, "(.+)",\s*(.+swig_class.+ (.+?)\->.+|\s+rb_cObject\));/)
|
13
|
+
clase=$1
|
14
|
+
final=$3
|
15
|
+
clase_padre=$4
|
16
|
+
ruta=$2.split("_")
|
17
|
+
if(ruta.size>1)
|
18
|
+
mod="mTagLib"+ruta[0,ruta.size-1].join
|
19
|
+
clas=ruta[ruta.size-1]
|
20
|
+
if clase_padre.nil?
|
21
|
+
linea=sprintf("%s = rb_define_class_under(%s, \"%s\", rb_cObject);",clase,mod,clas)
|
22
|
+
else
|
23
|
+
linea=<<HERE
|
24
|
+
#{clase} = rb_define_class_under(#{mod}, "#{clas}", ((swig_class *) #{clase_padre}->clientdata)->klass);
|
25
|
+
HERE
|
26
|
+
|
27
|
+
end
|
28
|
+
#p linea
|
29
|
+
fo.puts(linea)
|
30
|
+
else
|
31
|
+
fo.puts l
|
32
|
+
end
|
33
|
+
else
|
34
|
+
fo.puts l
|
35
|
+
end
|
36
|
+
}
|
37
|
+
}
|
38
|
+
fo.close
|
data/swig/taglib.i
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
%module
|
1
|
+
%module TagLib
|
2
2
|
%{
|
3
3
|
#include "taglib/tlist.h"
|
4
4
|
#include "taglib/fileref.h"
|
@@ -71,6 +71,20 @@ typedef const char * FileName;
|
|
71
71
|
}
|
72
72
|
%}
|
73
73
|
|
74
|
+
%init %{
|
75
|
+
VALUE mTagLibFLAC = rb_define_module_under(mTagLib, "FLAC");
|
76
|
+
VALUE mTagLibAPE = rb_define_module_under(mTagLib, "APE");
|
77
|
+
VALUE mTagLibID3v1 = rb_define_module_under(mTagLib, "ID3v1");
|
78
|
+
VALUE mTagLibID3v2 = rb_define_module_under(mTagLib, "ID3v2");
|
79
|
+
VALUE mTagLibMPC= rb_define_module_under(mTagLib, "MPC");
|
80
|
+
VALUE mTagLibMPEG = rb_define_module_under(mTagLib, "MPEG");
|
81
|
+
VALUE mTagLibOgg = rb_define_module_under(mTagLib, "Ogg");
|
82
|
+
VALUE mTagLibOggFlac = rb_define_module_under(mTagLibOgg, "Flac");
|
83
|
+
VALUE mTagLibOggSpeex = rb_define_module_under(mTagLibOgg, "Speex");
|
84
|
+
VALUE mTagLibVorbis = rb_define_module_under(mTagLib, "Vorbis");
|
85
|
+
VALUE mTagLibTrueAudio = rb_define_module_under(mTagLib, "TrueAudio");
|
86
|
+
VALUE mTagLibWavPack = rb_define_module_under(mTagLib, "WavPack");
|
87
|
+
%}
|
74
88
|
|
75
89
|
%define MAP_HELPERS(TYPE,FUNC)
|
76
90
|
%extend Map<TagLib::String, TYPE> {
|
@@ -109,6 +123,7 @@ virtual int channels () const;
|
|
109
123
|
%enddef
|
110
124
|
|
111
125
|
%define TAG_VIRTUALS()
|
126
|
+
|
112
127
|
%alias setTitle "title="
|
113
128
|
%alias setArtist "artist="
|
114
129
|
%alias setAlbum "album="
|
@@ -117,6 +132,7 @@ virtual int channels () const;
|
|
117
132
|
%alias setYear "year="
|
118
133
|
%alias setTrack "track="
|
119
134
|
%alias isEmpty "empty?"
|
135
|
+
|
120
136
|
virtual ~Tag();
|
121
137
|
virtual String title() const;
|
122
138
|
virtual String artist() const;
|
@@ -135,8 +151,7 @@ virtual void setTrack(uint i);
|
|
135
151
|
virtual bool isEmpty();
|
136
152
|
%enddef
|
137
153
|
|
138
|
-
|
139
|
-
|
154
|
+
%feature("autodoc",1);
|
140
155
|
namespace TagLib {
|
141
156
|
|
142
157
|
//rename(TagLib_File) File;
|
@@ -230,14 +245,16 @@ class ByteVector {
|
|
230
245
|
class File {
|
231
246
|
protected:
|
232
247
|
File(FileName file);
|
248
|
+
|
233
249
|
void setValid (bool valid);
|
234
250
|
void truncate (long length);
|
235
251
|
public:
|
252
|
+
#ifdef SWIGRUBY
|
236
253
|
%alias readOnly "read_only?"
|
237
254
|
%alias isWritable "writable?"
|
238
255
|
%alias isOpen "open?"
|
239
256
|
%alias isValid "valid?"
|
240
|
-
|
257
|
+
#endif
|
241
258
|
enum Position { Beginning, Current, End };
|
242
259
|
FileName name() const;
|
243
260
|
virtual ~File ();
|
@@ -292,7 +309,9 @@ class File {
|
|
292
309
|
|
293
310
|
template<class Key, class T> class Map {
|
294
311
|
public:
|
312
|
+
#ifdef SWIGRUBY
|
295
313
|
%alias isEmpty "empty?"
|
314
|
+
#endif
|
296
315
|
Map();
|
297
316
|
template <class Key,class T> Map(const Map< Key, T > &m);
|
298
317
|
~Map();
|
@@ -331,7 +350,9 @@ class File {
|
|
331
350
|
class FileRef {
|
332
351
|
public:
|
333
352
|
static StringList defaultFileExtensions ();
|
353
|
+
#ifdef SWIGRUBY
|
334
354
|
%alias isNull "null?"
|
355
|
+
#endif
|
335
356
|
FileRef(FileName fileName, bool readAudioProperties = true, AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
|
336
357
|
~FileRef();
|
337
358
|
Tag* tag();
|
@@ -346,8 +367,9 @@ class File {
|
|
346
367
|
namespace APE {
|
347
368
|
typedef Map<TagLib::String,TagLib::APE::Item> ItemListMap;
|
348
369
|
|
349
|
-
%rename(
|
350
|
-
%rename(
|
370
|
+
%rename(APE_Tag) Tag;
|
371
|
+
%rename(APE_Item) Item;
|
372
|
+
%rename(APE_Footer) Footer;
|
351
373
|
|
352
374
|
class Footer {
|
353
375
|
public:
|
@@ -570,6 +592,7 @@ class File {
|
|
570
592
|
};
|
571
593
|
};
|
572
594
|
namespace ID3v2 {
|
595
|
+
%rename(ID3v2_AttachedPictureFrame) AttachedPictureFrame;
|
573
596
|
%rename(ID3v2_Tag) Tag;
|
574
597
|
%rename(ID3v2_Header) Header;
|
575
598
|
%rename(ID3v2_CommentsFrame) CommentsFrame;
|
@@ -646,7 +669,7 @@ class File {
|
|
646
669
|
PROPERTIES_VIRTUALS()
|
647
670
|
int sampleWidth();
|
648
671
|
};
|
649
|
-
|
672
|
+
%feature("docstring","/*\n Document-class: TagLib::FLAC::File < TagLib::File\n*/\n") File;
|
650
673
|
class File : public TagLib::File {
|
651
674
|
public:
|
652
675
|
File(FileName file, bool readProperties=true, Properties::ReadStyle propertiesStyle=Properties::Average);
|
@@ -743,7 +766,7 @@ void strip (int tags=AllTags);
|
|
743
766
|
%rename(MPEG_File) File;
|
744
767
|
%rename(MPEG_Properties) Properties;
|
745
768
|
%rename(MPEG_Header) Header;
|
746
|
-
|
769
|
+
%rename(MPEG_XingHeader) XingHeader;
|
747
770
|
class Header {
|
748
771
|
public:
|
749
772
|
enum Version { Version1 = 0, Version2 = 1, Version2_5 = 2 };
|
data/swig/test.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|
|