rtaglib 0.2.2 → 0.2.3
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 +15 -3
- data/README.txt +21 -2
- data/Rakefile +15 -10
- data/ext/tagfile/extconf.rb +6 -0
- data/ext/taglib/extconf.rb +11 -4
- data/ext/taglib/taglib.cxx +1670 -548
- data/lib/TagLib.rb +7 -2
- data/lib/TagLib_doc.rb +1489 -1369
- data/swig/Rakefile +2 -5
- data/swig/extconf.rb +11 -4
- data/swig/taglib.i +105 -43
- data/swig/test.rb +59 -3
- data/test/test_taglib.rb +59 -3
- data/test/test_write.rb +9 -2
- metadata +2 -2
data/swig/Rakefile
CHANGED
@@ -13,20 +13,17 @@ task :docs => ["TagLib_doc.rb"] do |t|
|
|
13
13
|
system %(rdoc -f html TagLib_doc.rb)
|
14
14
|
end
|
15
15
|
|
16
|
-
file "Doxyfile" do |t|
|
17
|
-
system %("touch Doxyfile")
|
18
|
-
end
|
19
|
-
|
20
16
|
file "TagLib_doc.rb" => ["make_doc.rb","TagLib.so","doxygen"] do |t|
|
21
17
|
system %(ruby make_doc.rb)
|
22
18
|
end
|
19
|
+
|
23
20
|
file "doxygen" => ["Doxyfile"] do |t|
|
24
21
|
system %(doxygen)
|
25
22
|
end
|
26
23
|
task :test => ["TagLib.so"] do |t|
|
27
24
|
system %(ruby "test.rb")
|
28
25
|
end
|
29
|
-
task :copy => [:test,
|
26
|
+
task :copy => [:test, "TagLib_doc.rb"] do |t|
|
30
27
|
system %(cp extconf.rb taglib.cxx ../ext/taglib/)
|
31
28
|
system %(cp test.rb ../test/test_taglib.rb)
|
32
29
|
system %(cp TagLib_doc.rb ../lib/)
|
data/swig/extconf.rb
CHANGED
@@ -5,11 +5,18 @@ if(PLATFORM=~/mingw/)
|
|
5
5
|
$CFLAGS= " -I/mingw/include/taglib"
|
6
6
|
|
7
7
|
else
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
puts "Building for other architecture"
|
9
|
+
taglib_config = find_executable("taglib-config")
|
10
|
+
if taglib_config
|
11
|
+
prefix = `#{taglib_config} --prefix`.strip
|
12
|
+
$CFLAGS += " -I#{prefix}/include"
|
13
|
+
$LDFLAGS += " -L#{prefix}/lib"
|
14
|
+
else
|
15
|
+
prefix = "/usr"
|
16
|
+
end
|
17
|
+
$CFLAGS += " -I#{prefix}/include/taglib"
|
11
18
|
end
|
12
|
-
|
19
|
+
$libs = append_library($libs, "supc++")
|
13
20
|
if have_header("taglib/taglib_export.h") and have_library("tag")
|
14
21
|
create_makefile("TagLib")
|
15
22
|
end
|
data/swig/taglib.i
CHANGED
@@ -56,19 +56,37 @@ typedef std::basic_string< wchar > wstring;
|
|
56
56
|
typedef const char * FileName;
|
57
57
|
%}
|
58
58
|
|
59
|
+
|
59
60
|
%{
|
60
|
-
VALUE
|
61
|
+
VALUE ByteVector2Ruby(const TagLib::ByteVector *bv) {
|
62
|
+
return rb_tainted_str_new(bv->data(),bv->size());;
|
63
|
+
}
|
64
|
+
VALUE String2Ruby(const TagLib::String *st) {
|
65
|
+
return rb_tainted_str_new2(st->toCString(!st->isLatin1()));
|
66
|
+
}
|
67
|
+
|
68
|
+
VALUE StringList2Ruby(const TagLib::StringList *st) {
|
61
69
|
VALUE ary=Qnil;
|
62
|
-
if(st
|
63
|
-
ary=rb_ary_new2(st
|
64
|
-
for(uint i=0;i<(st
|
65
|
-
|
66
|
-
|
67
|
-
rb_ary_push(ary, rb_tainted_str_new2(ch));
|
70
|
+
if(st->size()>0) {
|
71
|
+
ary=rb_ary_new2(st->size());
|
72
|
+
for(uint i=0;i<(st->size());i++) {
|
73
|
+
const TagLib::String *val=&(st->operator[](i));
|
74
|
+
rb_ary_push(ary, String2Ruby(val));
|
68
75
|
}
|
69
76
|
}
|
70
77
|
return ary;
|
71
78
|
}
|
79
|
+
VALUE FrameList2Ruby(const TagLib::ID3v2::FrameList *st) {
|
80
|
+
VALUE ary=Qnil;
|
81
|
+
if(st->size()>0) {
|
82
|
+
ary=rb_ary_new2(st->size());
|
83
|
+
for(uint i=0;i<(st->size());i++) {
|
84
|
+
rb_ary_push(ary, SWIG_NewPointerObj(st->operator[](i), SWIGTYPE_p_TagLib__ID3v2__Frame, 0));
|
85
|
+
}
|
86
|
+
}
|
87
|
+
return ary;
|
88
|
+
}
|
89
|
+
|
72
90
|
%}
|
73
91
|
|
74
92
|
%init %{
|
@@ -86,11 +104,12 @@ typedef const char * FileName;
|
|
86
104
|
VALUE mTagLibWavPack = rb_define_module_under(mTagLib, "WavPack");
|
87
105
|
%}
|
88
106
|
|
89
|
-
%define MAP_HELPERS(
|
90
|
-
%extend Map<
|
91
|
-
VALUE __getitem__(
|
107
|
+
%define MAP_HELPERS(KEY_TYPE,VALUE_TYPE,FUNC_KEY,FUNC_VALUE)
|
108
|
+
%extend Map<KEY_TYPE, VALUE_TYPE> {
|
109
|
+
VALUE __getitem__(KEY_TYPE &item) {
|
92
110
|
if($self->contains(item)) {
|
93
|
-
|
111
|
+
VALUE_TYPE val=$self->operator[](item);
|
112
|
+
return FUNC_VALUE(&val);
|
94
113
|
} else {
|
95
114
|
return Qnil;
|
96
115
|
}
|
@@ -98,9 +117,9 @@ typedef const char * FileName;
|
|
98
117
|
VALUE __hash__() {
|
99
118
|
uint i;
|
100
119
|
VALUE hash=rb_hash_new();
|
101
|
-
for(std::map<
|
102
|
-
VALUE key=
|
103
|
-
VALUE ary=
|
120
|
+
for(std::map<KEY_TYPE,VALUE_TYPE>::const_iterator it=$self->begin(); it!=$self->end();it++) {
|
121
|
+
VALUE key=FUNC_KEY(&it->first);
|
122
|
+
VALUE ary=FUNC_VALUE(&it->second);
|
104
123
|
rb_hash_aset(hash,key,ary);
|
105
124
|
}
|
106
125
|
return hash;
|
@@ -168,19 +187,16 @@ namespace TagLib {
|
|
168
187
|
};
|
169
188
|
|
170
189
|
|
171
|
-
%typemap(out) TagLib::StringList &{
|
172
|
-
$result=StringList2Ruby($1);
|
173
|
-
}
|
174
190
|
|
175
191
|
%typemap(out) TagLib::StringList {
|
176
|
-
$result=StringList2Ruby(
|
192
|
+
$result=StringList2Ruby(&$1);
|
177
193
|
}
|
178
194
|
|
179
195
|
%apply TagLib::StringList & {TagLib::StringList const &};
|
180
196
|
|
181
197
|
|
182
198
|
%typemap(out) String {
|
183
|
-
$result =
|
199
|
+
$result = String2Ruby(&$1);
|
184
200
|
};
|
185
201
|
|
186
202
|
%typemap(in) String {
|
@@ -189,16 +205,23 @@ namespace TagLib {
|
|
189
205
|
|
190
206
|
|
191
207
|
%apply String {String &, const String &};
|
192
|
-
|
193
208
|
%typemap(in) ByteVector {
|
209
|
+
Check_Type($input, T_STRING);
|
194
210
|
$1=new TagLib::ByteVector(StringValuePtr($input), RSTRING_LEN($input));
|
195
211
|
};
|
196
212
|
|
213
|
+
|
197
214
|
%typemap(out) ByteVector {
|
198
215
|
$result = rb_tainted_str_new($1.data(),$1.size());
|
199
216
|
};
|
200
217
|
|
201
|
-
%apply ByteVector {ByteVector &, const ByteVector &};
|
218
|
+
%apply ByteVector {ByteVector &, const ByteVector &, ByteVector const &};
|
219
|
+
|
220
|
+
%typemap(out) TagLib::ID3v2::FrameList {
|
221
|
+
$result = FrameList2Ruby($1);
|
222
|
+
};
|
223
|
+
|
224
|
+
%apply TagLib::ID3v2::FrameList {TagLib::ID3v2::FrameList &, const TagLib::ID3v2::FrameList &, TagLib::ID3v2::FrameList const &};
|
202
225
|
|
203
226
|
class AudioProperties {
|
204
227
|
AudioProperties(ReadStyle style);
|
@@ -330,16 +353,20 @@ class File {
|
|
330
353
|
|
331
354
|
};
|
332
355
|
// Helpers for FieldListMap
|
333
|
-
|
356
|
+
|
357
|
+
MAP_HELPERS(TagLib::String, TagLib::StringList, String2Ruby, StringList2Ruby)
|
334
358
|
// Helpers for GenreMap
|
335
|
-
MAP_HELPERS(int,INT2FIX)
|
359
|
+
MAP_HELPERS(TagLib::String, int, String2Ruby, INT2FIX)
|
360
|
+
// Helpers for FrameListMap
|
361
|
+
MAP_HELPERS(TagLib::ByteVector, TagLib::ID3v2::FrameList, ByteVector2Ruby, FrameList2Ruby)
|
362
|
+
|
336
363
|
|
337
364
|
|
338
365
|
%template (FieldListMap) Map<TagLib::String, TagLib::StringList>;
|
339
366
|
%template (ItemListMap) Map<TagLib::String, TagLib::APE::Item>;
|
340
367
|
%template (GenreMap) Map<TagLib::String, int>;
|
341
368
|
%template (FrameListMap) Map < TagLib::ByteVector, TagLib::ID3v2::FrameList >;
|
342
|
-
|
369
|
+
|
343
370
|
%template (StringList) List< TagLib::String >;
|
344
371
|
%template (ByteVectorList) List<TagLib::ByteVector>;
|
345
372
|
%template (FrameList) List< TagLib::ID3v2::Frame * >;
|
@@ -347,6 +374,9 @@ class File {
|
|
347
374
|
typedef List<TagLib::ByteVector> ByteVectorList;
|
348
375
|
typedef List<TagLib::String> StringList;
|
349
376
|
|
377
|
+
// Extends FrameListMap
|
378
|
+
|
379
|
+
|
350
380
|
class FileRef {
|
351
381
|
public:
|
352
382
|
static StringList defaultFileExtensions ();
|
@@ -436,10 +466,7 @@ class File {
|
|
436
466
|
|
437
467
|
};
|
438
468
|
};
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
469
|
+
|
443
470
|
|
444
471
|
|
445
472
|
namespace Ogg {
|
@@ -568,13 +595,14 @@ class File {
|
|
568
595
|
};
|
569
596
|
|
570
597
|
class File : public TagLib::Ogg::File {
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
598
|
+
public:
|
599
|
+
File(FileName file, bool readProperties=true, Properties::ReadStyle propertiesStyle=Properties::Average);
|
600
|
+
virtual ~File ();
|
601
|
+
virtual Ogg::XiphComment * tag () const;
|
602
|
+
virtual Properties * audioProperties () const;
|
603
|
+
virtual bool save ();
|
576
604
|
};
|
577
|
-
|
605
|
+
}
|
578
606
|
namespace ID3v1 {
|
579
607
|
|
580
608
|
typedef Map<TagLib::String,int> GenreMap;
|
@@ -601,12 +629,33 @@ class File {
|
|
601
629
|
%rename(ID3v2_AttachedPictureFrame) AttachedPictureFrame;
|
602
630
|
%rename(ID3v2_Tag) Tag;
|
603
631
|
%rename(ID3v2_Header) Header;
|
632
|
+
%rename(ID3v2_Frame) Frame;
|
604
633
|
%rename(ID3v2_CommentsFrame) CommentsFrame;
|
605
634
|
%rename(ID3v2_FrameFactory) FrameFactory;
|
606
635
|
%rename(ID3v2_GeneralEncapsulatedObjectFrame) GeneralEncapsulatedObjectFrame;
|
607
636
|
typedef List< Frame * >FrameList;
|
608
637
|
typedef Map < ByteVector, FrameList > FrameListMap;
|
609
|
-
|
638
|
+
|
639
|
+
class Header {
|
640
|
+
Header();
|
641
|
+
|
642
|
+
};
|
643
|
+
|
644
|
+
|
645
|
+
class Frame : public TagLib::ID3v2::Header {
|
646
|
+
public:
|
647
|
+
virtual ~Frame ();
|
648
|
+
ByteVector frameID () const;
|
649
|
+
uint size () const ;
|
650
|
+
%extend {
|
651
|
+
VALUE __str__() {
|
652
|
+
return rb_tainted_str_new2($self->toString().toCString(false));
|
653
|
+
}
|
654
|
+
};
|
655
|
+
|
656
|
+
};
|
657
|
+
|
658
|
+
class AttachedPictureFrame : public TagLib::ID3v2::Frame {
|
610
659
|
public:
|
611
660
|
enum Type {
|
612
661
|
Other = 0x00, FileIcon = 0x01, OtherFileIcon = 0x02, FrontCover = 0x03,
|
@@ -615,9 +664,17 @@ class File {
|
|
615
664
|
Lyricist = 0x0C, RecordingLocation = 0x0D, DuringRecording = 0x0E, DuringPerformance = 0x0F,
|
616
665
|
MovieScreenCapture = 0x10, ColouredFish = 0x11, Illustration = 0x12, BandLogo = 0x13,
|
617
666
|
PublisherLogo = 0x14
|
618
|
-
};
|
667
|
+
};
|
619
668
|
AttachedPictureFrame ();
|
620
|
-
AttachedPictureFrame (const ByteVector &data);
|
669
|
+
//AttachedPictureFrame (const ByteVector &data);
|
670
|
+
|
671
|
+
%extend {
|
672
|
+
static AttachedPictureFrame *new2(const ByteVector &data) {
|
673
|
+
return new TagLib::ID3v2::AttachedPictureFrame(data);
|
674
|
+
}
|
675
|
+
}
|
676
|
+
|
677
|
+
|
621
678
|
virtual ~AttachedPictureFrame ();
|
622
679
|
virtual String toString () const;
|
623
680
|
String::Type textEncoding () const;
|
@@ -632,10 +689,13 @@ class File {
|
|
632
689
|
void setPicture (const ByteVector &p);
|
633
690
|
};
|
634
691
|
|
635
|
-
class CommentsFrame {
|
692
|
+
class CommentsFrame : public TagLib::ID3v2::Frame {
|
693
|
+
|
636
694
|
static CommentsFrame* TagLib::ID3v2::CommentsFrame::findByDescription ( const Tag * tag, const String & d);
|
695
|
+
public:
|
637
696
|
CommentsFrame (String::Type encoding=String::Latin1);
|
638
|
-
CommentsFrame (const ByteVector &data);
|
697
|
+
//CommentsFrame (const ByteVector &data);
|
698
|
+
|
639
699
|
virtual ~CommentsFrame ();
|
640
700
|
virtual String toString () const;
|
641
701
|
ByteVector language () const;
|
@@ -667,16 +727,18 @@ class File {
|
|
667
727
|
FrameFactory();
|
668
728
|
~FrameFactory();
|
669
729
|
};
|
670
|
-
class Header {
|
671
|
-
Header();
|
672
|
-
|
673
|
-
};
|
674
730
|
class Tag : public TagLib::Tag {
|
675
731
|
public:
|
676
732
|
Tag();
|
677
733
|
Tag(File *file, long tagOffset, const FrameFactory* factory);
|
678
734
|
TAG_VIRTUALS()
|
679
735
|
Header *header();
|
736
|
+
%apply SWIGTYPE *DISOWN {Frame *frame};
|
737
|
+
void addFrame (Frame *frame);
|
738
|
+
%clear Frame *frame;
|
739
|
+
|
740
|
+
const FrameListMap& frameListMap() const;
|
741
|
+
const FrameList& frameList() const;
|
680
742
|
};
|
681
743
|
};
|
682
744
|
|
data/swig/test.rb
CHANGED
@@ -44,7 +44,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
44
44
|
def test_file
|
45
45
|
mp3=@data_dir+"440Hz-5sec.mp3"
|
46
46
|
copy=get_copy(mp3)
|
47
|
-
file=TagLib::MPEG::File.new(
|
47
|
+
file=TagLib::MPEG::File.new(copy)
|
48
48
|
assert(file.writable?)
|
49
49
|
assert(file.open?)
|
50
50
|
assert(file.valid?)
|
@@ -63,7 +63,14 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
63
63
|
needle=sprintf("%c%c%c%c%c",0x22,0x22,0x22,0xE6,0x63)
|
64
64
|
assert_equal(-1,file.find2(needle,0))
|
65
65
|
assert_equal(0x7B46,file.length())
|
66
|
-
|
66
|
+
expected=sprintf("%c%c%c%c%c%c",0x01,0x02,0x03,0x04,0x05,0x06)
|
67
|
+
file.seek(0)
|
68
|
+
file.writeBlock(expected)
|
69
|
+
file.save
|
70
|
+
file=nil
|
71
|
+
file=TagLib::MPEG::File.new(copy)
|
72
|
+
file.seek(0)
|
73
|
+
#assert_equal(expected,file.readBlock(6))
|
67
74
|
end
|
68
75
|
# TagLib::FileRef test for
|
69
76
|
# - ::defaultFileExtensions()
|
@@ -78,7 +85,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
78
85
|
bitrate={'flac'=>168,'wv'=>235,'mp3'=>48,'mpc'=>41,'ogg'=>80}
|
79
86
|
channels={'flac'=>1,'wv'=>1,'mp3'=>1,'mpc'=>2,'ogg'=>1}
|
80
87
|
|
81
|
-
Dir.glob(@data_dir+"
|
88
|
+
Dir.glob(@data_dir+"/440*").each{|f|
|
82
89
|
fr=TagLib::FileRef.new(f)
|
83
90
|
f=~/.+\.(.+)/
|
84
91
|
ext=$1
|
@@ -121,6 +128,55 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
121
128
|
assert_equal("Rock",fr3.tag.genre)
|
122
129
|
assert_equal("new comment",fr3.tag.comment)
|
123
130
|
|
131
|
+
end
|
132
|
+
# Bug 2009-05-15
|
133
|
+
# Reporter: Jason Newton
|
134
|
+
# Assign UTF8 strings to tags return garbage
|
135
|
+
def test_bug_2009_05_15
|
136
|
+
mp3=@data_dir+"440Hz-5sec.mp3"
|
137
|
+
copy=get_copy(mp3)
|
138
|
+
copy2=get_copy(mp3)
|
139
|
+
fr=TagLib::FileRef.new(copy)
|
140
|
+
utf8_string="大塚愛"
|
141
|
+
expected="\345\244\247\345\241\232\346\204\233"
|
142
|
+
fr.tag().title=utf8_string
|
143
|
+
fr.save
|
144
|
+
fr=nil
|
145
|
+
fr=TagLib::FileRef.new(copy)
|
146
|
+
assert_equal(expected,fr.tag.title)
|
147
|
+
|
148
|
+
mp3=@data_dir+"test_jason.mp3"
|
149
|
+
s=get_copy(mp3)
|
150
|
+
d=get_copy(mp3)
|
151
|
+
s_tag=TagLib::FileRef.new(s)
|
152
|
+
d_tag=TagLib::FileRef.new(d)
|
153
|
+
artist="大塚愛"
|
154
|
+
# puts "artist = #{artist} => #{artist.inspect}"
|
155
|
+
assert_equal(artist,s_tag.tag.artist)
|
156
|
+
assert_equal(artist,d_tag.tag.artist)
|
157
|
+
d_tag.tag.artist=s_tag.tag.artist
|
158
|
+
assert_equal(d_tag.tag.artist, s_tag.tag.artist)
|
159
|
+
d_tag.save
|
160
|
+
d_tag=TagLib::FileRef.new(d)
|
161
|
+
assert_equal(d_tag.tag.artist, s_tag.tag.artist)
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
ogg=@data_dir+"test_jason.ogg"
|
166
|
+
s=get_copy(ogg)
|
167
|
+
d=get_copy(ogg)
|
168
|
+
s_tag=TagLib::FileRef.new(s)
|
169
|
+
d_tag=TagLib::FileRef.new(d)
|
170
|
+
artist="大塚愛"
|
171
|
+
# puts "artist = #{artist} => #{artist.inspect}"
|
172
|
+
assert_equal(artist,s_tag.tag.artist)
|
173
|
+
assert_equal(artist,d_tag.tag.artist)
|
174
|
+
d_tag.tag.artist=s_tag.tag.artist
|
175
|
+
assert_equal(d_tag.tag.artist, s_tag.tag.artist)
|
176
|
+
d_tag.save
|
177
|
+
d_tag=TagLib::FileRef.new(d)
|
178
|
+
assert_equal(d_tag.tag.artist, s_tag.tag.artist)
|
179
|
+
|
124
180
|
end
|
125
181
|
def test_flac
|
126
182
|
original=@data_dir+"440Hz-5sec.flac"
|
data/test/test_taglib.rb
CHANGED
@@ -44,7 +44,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
44
44
|
def test_file
|
45
45
|
mp3=@data_dir+"440Hz-5sec.mp3"
|
46
46
|
copy=get_copy(mp3)
|
47
|
-
file=TagLib::MPEG::File.new(
|
47
|
+
file=TagLib::MPEG::File.new(copy)
|
48
48
|
assert(file.writable?)
|
49
49
|
assert(file.open?)
|
50
50
|
assert(file.valid?)
|
@@ -63,7 +63,14 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
63
63
|
needle=sprintf("%c%c%c%c%c",0x22,0x22,0x22,0xE6,0x63)
|
64
64
|
assert_equal(-1,file.find2(needle,0))
|
65
65
|
assert_equal(0x7B46,file.length())
|
66
|
-
|
66
|
+
expected=sprintf("%c%c%c%c%c%c",0x01,0x02,0x03,0x04,0x05,0x06)
|
67
|
+
file.seek(0)
|
68
|
+
file.writeBlock(expected)
|
69
|
+
file.save
|
70
|
+
file=nil
|
71
|
+
file=TagLib::MPEG::File.new(copy)
|
72
|
+
file.seek(0)
|
73
|
+
#assert_equal(expected,file.readBlock(6))
|
67
74
|
end
|
68
75
|
# TagLib::FileRef test for
|
69
76
|
# - ::defaultFileExtensions()
|
@@ -78,7 +85,7 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
78
85
|
bitrate={'flac'=>168,'wv'=>235,'mp3'=>48,'mpc'=>41,'ogg'=>80}
|
79
86
|
channels={'flac'=>1,'wv'=>1,'mp3'=>1,'mpc'=>2,'ogg'=>1}
|
80
87
|
|
81
|
-
Dir.glob(@data_dir+"
|
88
|
+
Dir.glob(@data_dir+"/440*").each{|f|
|
82
89
|
fr=TagLib::FileRef.new(f)
|
83
90
|
f=~/.+\.(.+)/
|
84
91
|
ext=$1
|
@@ -121,6 +128,55 @@ class RtaglibReadTestCase < Test::Unit::TestCase
|
|
121
128
|
assert_equal("Rock",fr3.tag.genre)
|
122
129
|
assert_equal("new comment",fr3.tag.comment)
|
123
130
|
|
131
|
+
end
|
132
|
+
# Bug 2009-05-15
|
133
|
+
# Reporter: Jason Newton
|
134
|
+
# Assign UTF8 strings to tags return garbage
|
135
|
+
def test_bug_2009_05_15
|
136
|
+
mp3=@data_dir+"440Hz-5sec.mp3"
|
137
|
+
copy=get_copy(mp3)
|
138
|
+
copy2=get_copy(mp3)
|
139
|
+
fr=TagLib::FileRef.new(copy)
|
140
|
+
utf8_string="大塚愛"
|
141
|
+
expected="\345\244\247\345\241\232\346\204\233"
|
142
|
+
fr.tag().title=utf8_string
|
143
|
+
fr.save
|
144
|
+
fr=nil
|
145
|
+
fr=TagLib::FileRef.new(copy)
|
146
|
+
assert_equal(expected,fr.tag.title)
|
147
|
+
|
148
|
+
mp3=@data_dir+"test_jason.mp3"
|
149
|
+
s=get_copy(mp3)
|
150
|
+
d=get_copy(mp3)
|
151
|
+
s_tag=TagLib::FileRef.new(s)
|
152
|
+
d_tag=TagLib::FileRef.new(d)
|
153
|
+
artist="大塚愛"
|
154
|
+
# puts "artist = #{artist} => #{artist.inspect}"
|
155
|
+
assert_equal(artist,s_tag.tag.artist)
|
156
|
+
assert_equal(artist,d_tag.tag.artist)
|
157
|
+
d_tag.tag.artist=s_tag.tag.artist
|
158
|
+
assert_equal(d_tag.tag.artist, s_tag.tag.artist)
|
159
|
+
d_tag.save
|
160
|
+
d_tag=TagLib::FileRef.new(d)
|
161
|
+
assert_equal(d_tag.tag.artist, s_tag.tag.artist)
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
ogg=@data_dir+"test_jason.ogg"
|
166
|
+
s=get_copy(ogg)
|
167
|
+
d=get_copy(ogg)
|
168
|
+
s_tag=TagLib::FileRef.new(s)
|
169
|
+
d_tag=TagLib::FileRef.new(d)
|
170
|
+
artist="大塚愛"
|
171
|
+
# puts "artist = #{artist} => #{artist.inspect}"
|
172
|
+
assert_equal(artist,s_tag.tag.artist)
|
173
|
+
assert_equal(artist,d_tag.tag.artist)
|
174
|
+
d_tag.tag.artist=s_tag.tag.artist
|
175
|
+
assert_equal(d_tag.tag.artist, s_tag.tag.artist)
|
176
|
+
d_tag.save
|
177
|
+
d_tag=TagLib::FileRef.new(d)
|
178
|
+
assert_equal(d_tag.tag.artist, s_tag.tag.artist)
|
179
|
+
|
124
180
|
end
|
125
181
|
def test_flac
|
126
182
|
original=@data_dir+"440Hz-5sec.flac"
|