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 +4 -4
- data/.travis.yml +6 -2
- data/Gemfile.lock +36 -14
- data/README.md +3 -8
- data/id3tag.gemspec +2 -1
- data/lib/id3tag/audio_file.rb +11 -3
- data/lib/id3tag/synchsafe_integer.rb +4 -4
- data/lib/id3tag/tag.rb +2 -2
- data/lib/id3tag/version.rb +1 -1
- data/spec/features/can_read_non_audio_files_spec.rb +2 -1
- data/spec/lib/id3tag/tag_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -0
- data/spec/support/mp3_fixtures.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ccd7d09b5680224f517388b816869e337d1041e
|
4
|
+
data.tar.gz: 608e4d9b4072420b86b5c53fe85cc30d0c7be16f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a82c303f0abc81661f7cf9f8ec2197770ed3fcc9f85254d8680372817fd4569b709bc1942b7055de85e0cbc41f85ad04e15f20e35e52bef4157791d9cfeb503c
|
7
|
+
data.tar.gz: 77890b09ebe42028bc0f96ede27bc71727563ac56c87d31bc85d6a255a26843311688aac9f8b48ee606826aecd93325cb9a5d99a6995db8198346fda70fde26f
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
id3tag (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.
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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.
|
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.
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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 (~>
|
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
|
-
|
data/id3tag.gemspec
CHANGED
@@ -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", "~>
|
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
|
data/lib/id3tag/audio_file.rb
CHANGED
@@ -10,8 +10,12 @@ module ID3Tag
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def v1_tag_present?
|
13
|
-
@file.
|
14
|
-
|
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.
|
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
|
6
|
+
while mask <= 0x7FFFFFFF
|
7
7
|
out = int & ~mask
|
8
8
|
out = out << 1
|
9
|
-
out
|
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
|
19
|
+
while mask > 0
|
20
20
|
out = out >> 1
|
21
|
-
out
|
21
|
+
out |= (synchsafe_int & mask)
|
22
22
|
mask = mask >> 8
|
23
23
|
end
|
24
24
|
out
|
data/lib/id3tag/tag.rb
CHANGED
@@ -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
|
|
data/lib/id3tag/version.rb
CHANGED
@@ -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(
|
5
|
+
subject { ID3Tag.read(Tempfile.new('fake_mp3')) }
|
5
6
|
|
6
7
|
it 'should return blanks' do
|
7
8
|
subject.title.should == nil
|
data/spec/lib/id3tag/tag_spec.rb
CHANGED
@@ -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 =>
|
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 =>
|
210
|
-
:v2_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
|
data/spec/spec_helper.rb
CHANGED
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.
|
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-
|
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:
|
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:
|
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
|