ruby-mp3info 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ === 0.7.2 / 2012-12-24
2
+
3
+ * do not try to commit changes to IO or StringIO
4
+
1
5
  === 0.7.1 / 2012-04-01
2
6
 
3
7
  * convert to utf-16 little endian (instead of big) for more compatibility
data/README.txt CHANGED
@@ -56,7 +56,7 @@ mp3 files.
56
56
 
57
57
  == REQUIREMENTS:
58
58
 
59
- * iconv
59
+ * iconv when using ruby 1.8
60
60
 
61
61
  == INSTALL:
62
62
 
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  class Mp3Info
20
20
 
21
- VERSION = "0.7.1"
21
+ VERSION = "0.7.2"
22
22
 
23
23
  LAYER = [ nil, 3, 2, 1]
24
24
  BITRATE = {
@@ -234,7 +234,7 @@ class Mp3Info
234
234
  def reload
235
235
  @header = {}
236
236
 
237
- if @filename_or_io.is_a?(StringIO)
237
+ if @filename_or_io.is_a?(StringIO) || @filename_or_io.is_a?(IO)
238
238
  @io_is_a_file = false
239
239
  @io = @filename_or_io
240
240
  @io_size = @io.size
@@ -683,7 +683,7 @@ private
683
683
  @length = ((stream_size << 3)/1000.0)/@bitrate
684
684
  # read the first 100 frames and decide if the mp3 is vbr and needs full scan
685
685
  begin
686
- bitrate, length = frame_scan(100)
686
+ bitrate = frame_scan(100).first
687
687
  if @bitrate != bitrate
688
688
  @vbr = true
689
689
  @bitrate, @length = frame_scan
@@ -65,11 +65,7 @@ class Mp3Info
65
65
  end
66
66
 
67
67
  def self.ruby_18_encode(from, to, value)
68
- begin
69
- Iconv.iconv(to, from, value).first
70
- rescue Iconv::Failure
71
- value
72
- end
68
+ Iconv.iconv(to, from, value).first
73
69
  end
74
70
 
75
71
  def self.decode_utf16(out)
@@ -223,7 +223,7 @@ class ID3v2 < DelegateClass(Hash)
223
223
  original_pos = @io.pos
224
224
  @io.extend(Mp3Info::Mp3FileMethods)
225
225
  version_maj, version_min, flags = @io.read(3).unpack("CCB4")
226
- @unsync, ext_header, experimental, footer = (0..3).collect { |i| flags[i].chr == '1' }
226
+ @unsync, ext_header, _, _ = (0..3).collect { |i| flags[i].chr == '1' } # _, _ = experimental, footer
227
227
  raise(ID3v2Error, "can't find version_maj ('#{version_maj}')") unless [2, 3, 4].include?(version_maj)
228
228
  @version_maj, @version_min = version_maj, version_min
229
229
  @tag_length = @io.get_syncsafe
@@ -447,6 +447,13 @@ class Mp3InfoTest < Test::Unit::TestCase
447
447
  assert_equal(expected, s.bytes.map{|b| b.to_s(16).rjust(2,"0")}.to_a.join(" "))
448
448
  end
449
449
 
450
+ def test_modifying_an_io
451
+ io = open(TEMP_FILE, "r")
452
+ Mp3Info.open(io) do |mp3|
453
+ mp3.tag.artist = "test_artist"
454
+ end
455
+ end
456
+
450
457
  def compute_audio_content_mp3_digest(mp3)
451
458
  pos, size = mp3.audio_content
452
459
  data = File.open(mp3.filename) do |f|
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.7.1
4
+ version: 0.7.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,30 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-01 00:00:00.000000000Z
12
+ date: 2012-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rdoc
16
- requirement: &73102580 !ruby/object:Gem::Requirement
15
+ name: hoe-yard
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '3.10'
21
+ version: 0.1.2
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *73102580
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.1.2
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: hoe
27
- requirement: &73101600 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
31
36
  - !ruby/object:Gem::Version
32
- version: '2.12'
37
+ version: '3.4'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *73101600
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.4'
36
46
  description: ! 'ruby-mp3info read low-level informations and manipulate tags on
37
47
 
38
48
  mp3 files.'
@@ -58,8 +68,9 @@ homepage: http://github.com/moumar/ruby-mp3info
58
68
  licenses: []
59
69
  post_install_message:
60
70
  rdoc_options:
61
- - --main
62
- - README.txt
71
+ - --title
72
+ - TestRuby::TestMp3info Documentation
73
+ - --quiet
63
74
  require_paths:
64
75
  - lib
65
76
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -76,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
87
  version: '0'
77
88
  requirements: []
78
89
  rubyforge_project: ruby-mp3info
79
- rubygems_version: 1.8.17
90
+ rubygems_version: 1.8.24
80
91
  signing_key:
81
92
  specification_version: 3
82
93
  summary: ruby-mp3info read low-level informations and manipulate tags on mp3 files.