ruby-mp3info 0.6.1 → 0.6.2
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 +7 -0
- data/lib/mp3info.rb +2 -2
- data/lib/mp3info/id3v2.rb +19 -19
- metadata +2 -2
data/History.txt
CHANGED
data/lib/mp3info.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: mp3info.rb
|
1
|
+
# $Id: mp3info.rb 71 2008-03-02 07:10:26Z moumar $
|
2
2
|
# License:: Ruby
|
3
3
|
# Author:: Guillaume Pierronnet (mailto:moumar_AT__rubyforge_DOT_org)
|
4
4
|
# Website:: http://ruby-mp3info.rubyforge.org/
|
@@ -18,7 +18,7 @@ end
|
|
18
18
|
|
19
19
|
class Mp3Info
|
20
20
|
|
21
|
-
VERSION = "0.6.
|
21
|
+
VERSION = "0.6.2"
|
22
22
|
|
23
23
|
LAYER = [ nil, 3, 2, 1]
|
24
24
|
BITRATE = [
|
data/lib/mp3info/id3v2.rb
CHANGED
@@ -194,7 +194,7 @@ class ID3v2 < DelegateClass(Hash)
|
|
194
194
|
puts "encode_tag(#{name.inspect}, #{value.inspect}, #{version})" if $DEBUG
|
195
195
|
|
196
196
|
text_encoding_index = @text_encoding_index
|
197
|
-
if version == 3
|
197
|
+
if (name[0] == ?T || name == "COMM" ) && version == 3
|
198
198
|
# in id3v2.3 tags, there is only 2 encodings possible
|
199
199
|
transcoded_value = value
|
200
200
|
if text_encoding_index >= 2
|
@@ -206,38 +206,38 @@ class ID3v2 < DelegateClass(Hash)
|
|
206
206
|
case name
|
207
207
|
when "COMM"
|
208
208
|
[ text_encoding_index , @options[:lang], 0, transcoded_value ].pack("ca3ca*")
|
209
|
-
when
|
210
|
-
value
|
211
|
-
else
|
209
|
+
when /^T/
|
212
210
|
text_encoding_index.chr + transcoded_value
|
211
|
+
else
|
212
|
+
value
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
216
|
### Read a tag from file and perform UNICODE translation if needed
|
217
217
|
def decode_tag(name, value)
|
218
|
+
puts("decode_tag(#{name.inspect}, #{value.inspect})") if $DEBUG
|
218
219
|
case name
|
219
220
|
when "COMM"
|
220
221
|
#FIXME improve this
|
221
222
|
encoding, lang, str = value.unpack("ca3a*")
|
222
223
|
out = value.split(0.chr).last
|
223
|
-
when
|
224
|
-
out = value
|
225
|
-
else
|
224
|
+
when /^T/
|
226
225
|
encoding = value[0] # language encoding (see TEXT_ENCODINGS constant)
|
227
226
|
out = value[1..-1]
|
227
|
+
# we need to convert the string in order to match
|
228
|
+
# the requested encoding
|
229
|
+
if encoding != @text_encoding_index
|
230
|
+
begin
|
231
|
+
Iconv.iconv(@options[:encoding], TEXT_ENCODINGS[encoding], out)[0]
|
232
|
+
rescue Iconv::Failure
|
233
|
+
out
|
234
|
+
end
|
235
|
+
else
|
236
|
+
out
|
237
|
+
end
|
238
|
+
else
|
239
|
+
value
|
228
240
|
end
|
229
|
-
|
230
|
-
printf("encoding: %d, value: %s\n", encoding, value.inspect) if $DEBUG
|
231
|
-
# we need to convert the string in order to match
|
232
|
-
# the requested encoding
|
233
|
-
if encoding && encoding != @text_encoding_index
|
234
|
-
begin
|
235
|
-
return Iconv.iconv(@options[:encoding], TEXT_ENCODINGS[encoding], out)[0]
|
236
|
-
rescue Iconv::Failure
|
237
|
-
return out
|
238
|
-
end
|
239
|
-
end
|
240
|
-
out
|
241
241
|
end
|
242
242
|
|
243
243
|
### reads id3 ver 2.3.x/2.4.x frames and adds the contents to @tag2 hash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-mp3info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Pierronnet
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-02
|
12
|
+
date: 2008-03-02 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|