ruby-taglib2 1.01 → 1.02
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/ruby-taglib2.cpp +29 -0
- data/lib/ruby_taglib2.rb +1 -1
- metadata +18 -4
data/ext/ruby-taglib2.cpp
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
#include <textidentificationframe.h>
|
1
2
|
#include <attachedpictureframe.h>
|
2
3
|
#include <fileref.h>
|
3
4
|
#include <flacfile.h>
|
@@ -161,6 +162,32 @@ static VALUE FileInitialize(VALUE self, VALUE path)
|
|
161
162
|
return Qnil; \
|
162
163
|
}
|
163
164
|
|
165
|
+
#define TextIdentificationAttribute(name, capName) \
|
166
|
+
static VALUE FileRead##capName(VALUE self) \
|
167
|
+
{ \
|
168
|
+
GetFileRef \
|
169
|
+
GetID3Tag \
|
170
|
+
CheckTag(f) \
|
171
|
+
if(!tag->frameListMap()["TSRC"].isEmpty()) return TStrToRubyStr(tag->frameListMap()["TSRC"].front()->toString()); \
|
172
|
+
else return TStrToRubyStr(""); \
|
173
|
+
} \
|
174
|
+
static VALUE FileWrite##capName(VALUE self, VALUE arg) \
|
175
|
+
{ \
|
176
|
+
GetFileRef \
|
177
|
+
GetID3Tag \
|
178
|
+
CheckTag(f) \
|
179
|
+
if(!tag->frameListMap()["TSRC"].isEmpty()) \
|
180
|
+
{ \
|
181
|
+
TagLib::List<TagLib::ID3v2::Frame*> frame = tag->frameListMap()["TSRC"]; \
|
182
|
+
frame.front()->setText(RubyStrToTStr(StringValue(arg))); \
|
183
|
+
} \
|
184
|
+
else \
|
185
|
+
{ \
|
186
|
+
TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame("TSRC", TagLib::String::Latin1); \
|
187
|
+
frame->setText(RubyStrToTStr(StringValue(arg))); \
|
188
|
+
tag->addFrame(frame); \
|
189
|
+
} \
|
190
|
+
}
|
164
191
|
|
165
192
|
#define StringAttribute(name, capName) \
|
166
193
|
static VALUE FileRead##capName(VALUE self) \
|
@@ -222,6 +249,7 @@ IntProperty(bitrate, Bitrate)
|
|
222
249
|
IntProperty(sampleRate, SampleRate)
|
223
250
|
IntProperty(channels, Channels)
|
224
251
|
IntProperty(length, Length)
|
252
|
+
TextIdentificationAttribute(isrc,Isrc)
|
225
253
|
|
226
254
|
////////////////////////
|
227
255
|
// TagLib2::File#save
|
@@ -436,6 +464,7 @@ extern "C" void Init_taglib2(void)
|
|
436
464
|
AttributeMethods(genre, Genre)
|
437
465
|
AttributeMethods(year, Year)
|
438
466
|
AttributeMethods(track, Track)
|
467
|
+
AttributeMethods(isrc, Isrc)
|
439
468
|
PropertyMethod(bitrate, Bitrate)
|
440
469
|
PropertyMethod(sampleRate, SampleRate)
|
441
470
|
PropertyMethod(sample_rate, SampleRate)
|
data/lib/ruby_taglib2.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-taglib2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 11
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
version: "1.02"
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Neil Stevens
|
8
13
|
- Saimon Moore
|
14
|
+
- Ben Colon
|
9
15
|
autorequire:
|
10
16
|
bindir: bin
|
11
17
|
cert_chain:
|
@@ -36,21 +42,29 @@ rdoc_options: []
|
|
36
42
|
require_paths:
|
37
43
|
- lib
|
38
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
39
46
|
requirements:
|
40
47
|
- - ">"
|
41
48
|
- !ruby/object:Gem::Version
|
49
|
+
hash: 31
|
50
|
+
segments:
|
51
|
+
- 0
|
52
|
+
- 0
|
53
|
+
- 0
|
42
54
|
version: 0.0.0
|
43
|
-
version:
|
44
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
45
57
|
requirements:
|
46
58
|
- - ">="
|
47
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
48
63
|
version: "0"
|
49
|
-
version:
|
50
64
|
requirements:
|
51
65
|
- Ruby bindings for Taglib's C Library
|
52
66
|
rubyforge_project:
|
53
|
-
rubygems_version: 1.3.
|
67
|
+
rubygems_version: 1.3.7
|
54
68
|
signing_key:
|
55
69
|
specification_version: 1
|
56
70
|
summary: ruby-taglib2 is a compiled extension to ruby that provides access to the TagLib library
|