id3tag 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae0e8d8a654a808950dc260c139c134a92553d15
4
- data.tar.gz: cfcae0b936e24c4fb733987b2fc492d2e02d5064
3
+ metadata.gz: 8ccd7d09b5680224f517388b816869e337d1041e
4
+ data.tar.gz: 608e4d9b4072420b86b5c53fe85cc30d0c7be16f
5
5
  SHA512:
6
- metadata.gz: 0964ce3767d4637b84450e6420017b9035994f9b9b28e86839d6ebea65cbb79c5be1dc932688b2cd7bea700553a7c833f1b2f3ce01a0d8e989b5860711f4adf6
7
- data.tar.gz: ca5440480c9b10ed97fa33d2ca34dd78e1b67c8b1e95e7ea3cc710c21af50e3b6161895812ab9ade5c51bfda1470de94a5789ed723ebe77a55473466b2f42948
6
+ metadata.gz: a82c303f0abc81661f7cf9f8ec2197770ed3fcc9f85254d8680372817fd4569b709bc1942b7055de85e0cbc41f85ad04e15f20e35e52bef4157791d9cfeb503c
7
+ data.tar.gz: 77890b09ebe42028bc0f96ede27bc71727563ac56c87d31bc85d6a255a26843311688aac9f8b48ee606826aecd93325cb9a5d99a6995db8198346fda70fde26f
@@ -1,9 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - ruby-head
4
+ - 2.1.2
4
5
  - 2.0.0
5
6
  - 1.9.3
6
7
  - jruby-19mode
7
8
  - jruby-head
8
- - rbx-19mode
9
- - rbx-2.1.1
9
+ - rbx-2
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: jruby-head
13
+ - rvm: ruby-head
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- id3tag (0.6.0)
4
+ id3tag (0.8.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
+ coderay (1.1.0)
9
10
  coveralls (0.7.0)
10
11
  multi_json (~> 1.3)
11
12
  rest-client
@@ -13,16 +14,33 @@ GEM
13
14
  term-ansicolor
14
15
  thor
15
16
  diff-lcs (1.2.5)
16
- docile (1.1.2)
17
+ docile (1.1.5)
18
+ ffi (1.9.3-x86-mingw32)
17
19
  json (1.8.1)
18
20
  json (1.8.1-java)
19
- mime-types (2.0)
20
- multi_json (1.8.4)
21
- rake (10.1.1)
22
- rdoc (3.12.2)
21
+ method_source (0.8.2)
22
+ mime-types (2.3)
23
+ multi_json (1.10.1)
24
+ netrc (0.7.7)
25
+ pry (0.10.0)
26
+ coderay (~> 1.1.0)
27
+ method_source (~> 0.8.1)
28
+ slop (~> 3.4)
29
+ pry (0.10.0-x86-mingw32)
30
+ coderay (~> 1.1.0)
31
+ method_source (~> 0.8.1)
32
+ slop (~> 3.4)
33
+ win32console (~> 1.3)
34
+ rake (10.3.2)
35
+ rdoc (4.1.1)
23
36
  json (~> 1.4)
24
- rest-client (1.6.7)
25
- mime-types (>= 1.16)
37
+ rest-client (1.7.2)
38
+ mime-types (>= 1.16, < 3.0)
39
+ netrc (~> 0.7)
40
+ rest-client (1.7.2-x86-mingw32)
41
+ ffi (~> 1.9)
42
+ mime-types (>= 1.16, < 3.0)
43
+ netrc (~> 0.7)
26
44
  rspec (2.13.0)
27
45
  rspec-core (~> 2.13.0)
28
46
  rspec-expectations (~> 2.13.0)
@@ -31,25 +49,29 @@ GEM
31
49
  rspec-expectations (2.13.0)
32
50
  diff-lcs (>= 1.1.3, < 2.0)
33
51
  rspec-mocks (2.13.1)
34
- simplecov (0.8.2)
52
+ simplecov (0.9.0)
35
53
  docile (~> 1.1.0)
36
54
  multi_json
37
55
  simplecov-html (~> 0.8.0)
38
56
  simplecov-html (0.8.0)
39
- term-ansicolor (1.2.2)
40
- tins (~> 0.8)
41
- thor (0.18.1)
42
- tins (0.13.1)
57
+ slop (3.5.0)
58
+ term-ansicolor (1.3.0)
59
+ tins (~> 1.0)
60
+ thor (0.19.1)
61
+ tins (1.3.0)
62
+ win32console (1.3.2-x86-mingw32)
43
63
 
44
64
  PLATFORMS
45
65
  java
46
66
  ruby
67
+ x86-mingw32
47
68
 
48
69
  DEPENDENCIES
49
70
  bundler (~> 1.3)
50
71
  coveralls
51
72
  id3tag!
73
+ pry
52
74
  rake
53
- rdoc (~> 3.12)
75
+ rdoc (~> 4.1.1)
54
76
  rspec (~> 2.13.0)
55
77
  simplecov
data/README.md CHANGED
@@ -21,7 +21,7 @@ Require the libary and read basic metadata:
21
21
  ```ruby
22
22
  require "id3tag"
23
23
 
24
- mp3_file = File.open('/path/to/your/favorite_song.mp3')
24
+ mp3_file = File.open('/path/to/your/favorite_song.mp3', "rb")
25
25
  tag = ID3Tag.read(mp3_file)
26
26
  puts "#{tag.artist} - #{tag.title}"
27
27
  ```
@@ -34,7 +34,7 @@ There can be more than one `comments` frame in the tag. They differ by language,
34
34
  mp3s = Dir.entries("/some/dir").select { |filename| filename =~ /\.mp3/i }
35
35
 
36
36
  mp3s.each do |file|
37
- ID3Tag.read(File.open(file)) do |tag|
37
+ ID3Tag.read(File.open(file, "rb")) do |tag|
38
38
  puts file
39
39
  puts tag.artist
40
40
  puts tag.title
@@ -75,7 +75,7 @@ end
75
75
 
76
76
 
77
77
  ## Contributing to id3tag
78
-
78
+
79
79
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
80
80
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
81
81
  * Fork the project.
@@ -90,8 +90,3 @@ end
90
90
 
91
91
  Copyright (c) 2013 Krists Ozols. See LICENSE.txt for
92
92
  further details.
93
-
94
-
95
-
96
- [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/krists/id3tag/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
97
-
@@ -20,8 +20,9 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_development_dependency "bundler", "~> 1.3"
22
22
  s.add_development_dependency "rake"
23
- s.add_development_dependency "rdoc", "~> 3.12"
23
+ s.add_development_dependency "rdoc", "~> 4.1.1"
24
24
  s.add_development_dependency "rspec", "~> 2.13.0"
25
25
  s.add_development_dependency "simplecov"
26
26
  s.add_development_dependency 'coveralls'
27
+ s.add_development_dependency 'pry'
27
28
  end
@@ -10,8 +10,12 @@ module ID3Tag
10
10
  end
11
11
 
12
12
  def v1_tag_present?
13
- @file.seek(-ID3V1_TAG_SIZE, IO::SEEK_END)
14
- @file.read(3) == IDV1_TAG_IDENTIFIER
13
+ if @file.size >= ID3V1_TAG_SIZE
14
+ @file.seek(-ID3V1_TAG_SIZE, IO::SEEK_END)
15
+ @file.read(3) == IDV1_TAG_IDENTIFIER
16
+ else
17
+ false
18
+ end
15
19
  end
16
20
 
17
21
  def v2_tag_present?
@@ -20,7 +24,11 @@ module ID3Tag
20
24
  end
21
25
 
22
26
  def v1_tag_body
23
- @file.seek(-ID3V1_TAG_SIZE + IDV1_TAG_IDENTIFIER.size, IO::SEEK_END)
27
+ if @file.size >= ID3V1_TAG_SIZE
28
+ @file.seek(-ID3V1_TAG_SIZE + IDV1_TAG_IDENTIFIER.size, IO::SEEK_END)
29
+ else
30
+ @file.rewind
31
+ end
24
32
  @file.read
25
33
  end
26
34
 
@@ -3,10 +3,10 @@ module ID3Tag
3
3
  class << self
4
4
  def encode(int)
5
5
  mask = 0x7F
6
- while mask <= 0x7FFFFFFF do
6
+ while mask <= 0x7FFFFFFF
7
7
  out = int & ~mask
8
8
  out = out << 1
9
- out = out | (int & mask)
9
+ out |= (int & mask)
10
10
  mask = ((mask + 1) << 8) - 1
11
11
  int = out
12
12
  end
@@ -16,9 +16,9 @@ module ID3Tag
16
16
  def decode(synchsafe_int)
17
17
  out = 0
18
18
  mask = 0x7F000000
19
- while mask > 0 do
19
+ while mask > 0
20
20
  out = out >> 1
21
- out = out | (synchsafe_int & mask)
21
+ out |= (synchsafe_int & mask)
22
22
  mask = mask >> 8
23
23
  end
24
24
  out
@@ -92,10 +92,10 @@ module ID3Tag
92
92
 
93
93
  def possible_frame_ids_by_name(name)
94
94
  ids = []
95
- id = possible_v1_frame_id_by_name(name)
96
- ids << id if id
97
95
  id = possible_v2_frame_id_by_name(name)
98
96
  ids << id if id
97
+ id = possible_v1_frame_id_by_name(name)
98
+ ids << id if id
99
99
  ids
100
100
  end
101
101
 
@@ -1,3 +1,3 @@
1
1
  module ID3Tag
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -1,7 +1,8 @@
1
1
  require 'spec_helper'
2
+ require 'tempfile'
2
3
 
3
4
  describe 'can read any file and does not raise errors if no tag found' do
4
- subject { ID3Tag.read(File.open('/dev/null')) }
5
+ subject { ID3Tag.read(Tempfile.new('fake_mp3')) }
5
6
 
6
7
  it 'should return blanks' do
7
8
  subject.title.should == nil
@@ -178,7 +178,7 @@ describe ID3Tag::Tag do
178
178
  audio_file.stub({
179
179
  :v1_tag_present? => true,
180
180
  :v2_tag_present? => true,
181
- :v2_tag_body => File.read(mp3_fixture("signals_1.mp3.v2_3_tag_body")),
181
+ :v2_tag_body => mp3_fixture("signals_1.mp3.v2_3_tag_body").read,
182
182
  :v2_tag_major_version_number => 3
183
183
  })
184
184
  end
@@ -206,8 +206,8 @@ describe ID3Tag::Tag do
206
206
  audio_file.stub({
207
207
  :v1_tag_present? => true,
208
208
  :v2_tag_present? => true,
209
- :v1_tag_body => File.read(mp3_fixture("pov_20131018-2100a.mp3.v1_tag_body")),
210
- :v2_tag_body => File.read(mp3_fixture("pov_20131018-2100a.mp3.v2_3_tag_body")),
209
+ :v1_tag_body => mp3_fixture("pov_20131018-2100a.mp3.v1_tag_body").read,
210
+ :v2_tag_body => mp3_fixture("pov_20131018-2100a.mp3.v2_3_tag_body").read,
211
211
  :v2_tag_major_version_number => 3
212
212
  })
213
213
  end
@@ -3,6 +3,7 @@ unless ENV['RUBY_VERSION'] =~ /rbx/
3
3
  require 'coveralls'
4
4
  Coveralls.wear!
5
5
  else
6
+ require 'pry'
6
7
  require 'simplecov'
7
8
  SimpleCov.start
8
9
  end
@@ -1,4 +1,4 @@
1
1
  def mp3_fixture(filename)
2
2
  fixtures_dir = File.expand_path('../../fixtures', __FILE__)
3
- File.open(File.join(fixtures_dir, filename))
3
+ File.open(File.join(fixtures_dir, filename), "rb")
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: id3tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krists Ozols
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-16 00:00:00.000000000 Z
11
+ date: 2014-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.12'
47
+ version: 4.1.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.12'
54
+ version: 4.1.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Native Ruby ID3 tag reader that aims for 100% covarage of ID3v2.x and
98
112
  ID3v1.x standards
99
113
  email: krists@iesals.lv