mp3file 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/lib/mp3file/mp3_file.rb +15 -4
- data/lib/mp3file/version.rb +1 -1
- data/spec/mp3file/id3v2/frame_header_spec.rb +6 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea56455b0c3fcd4691734fd996aa92b2e70c5bc
|
4
|
+
data.tar.gz: 577dad17813c5d17ff6f23db687ea98857f60e45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d06cbe98cbb7c9b86c13e3e0dc2ec2de5dabec8907145f9bf6860d35dcdaca0517e57a8d56d5596bf32f18c98fc535ca6e0b9c47e45de79173c80581efcd38fb
|
7
|
+
data.tar.gz: fcb827f6846adbac1a2f98186906875e30a8a44023baa01e0bb50018493a9a52e03bcd89490212cf3302cb4b2cdbaae0be2e0dac605ed740302f7601561f5315
|
data/.travis.yml
ADDED
data/lib/mp3file/mp3_file.rb
CHANGED
@@ -200,15 +200,23 @@ module Mp3file
|
|
200
200
|
end
|
201
201
|
@num_frames = frame_headers.size
|
202
202
|
else
|
203
|
-
# Use the Xing header to make the VBR
|
204
|
-
# Xing headers, when present in a CBR
|
205
|
-
|
203
|
+
# Use the presence and name of the Xing header to make the VBR
|
204
|
+
# / CBR call. Assume that Xing headers, when present in a CBR
|
205
|
+
# file, are called "Info".
|
206
|
+
@vbr = !@xing_header.nil? && @xing_header.name == "Xing"
|
206
207
|
end
|
207
208
|
|
209
|
+
# puts "@num_frames = #{@num_frames.inspect}"
|
210
|
+
# puts "@xing_header = #{@xing_header.inspect}"
|
211
|
+
# puts "@audio_size = #{@audio_size.inspect}"
|
212
|
+
# puts "@first_header size = #{@first_header.frame_size.inspect}"
|
213
|
+
|
208
214
|
# Find the number of frames. Prefer the actual frame count we
|
209
215
|
# did (if we scanned all the frames) over the Xing
|
210
216
|
# header. Prefer the Xing header over file size math.
|
211
|
-
@num_frames = @num_frames ||
|
217
|
+
@num_frames = @num_frames ||
|
218
|
+
(@xing_header && (@xing_header.frames + 1)) ||
|
219
|
+
(@audio_size / @first_header.frame_size)
|
212
220
|
|
213
221
|
# Figure out the total samples and the time duration.
|
214
222
|
@total_samples = @num_frames * @first_header.samples
|
@@ -221,6 +229,9 @@ module Mp3file
|
|
221
229
|
@bitrate = ((@xing_header && @xing_header.bytes) || @audio_size) / @length.to_f * 8 / 1000
|
222
230
|
end
|
223
231
|
|
232
|
+
# puts "@vbr = #{@vbr.inspect}"
|
233
|
+
# puts "@bitrate = #{@bitrate.inspect}"
|
234
|
+
|
224
235
|
@file.close
|
225
236
|
end
|
226
237
|
|
data/lib/mp3file/version.rb
CHANGED
@@ -10,7 +10,8 @@ describe Mp3file::ID3v2::FrameHeader do
|
|
10
10
|
describe("A 15-byte long TT2 frame header.") do
|
11
11
|
subject { Mp3file::ID3v2::FrameHeader.new(StringIO.new("TT2\x00\x00\x0f"), tag) }
|
12
12
|
its(:frame_id) { should == 'TT2' }
|
13
|
-
its(:size) { should ==
|
13
|
+
its(:size) { should == 21 }
|
14
|
+
its(:frame_size) { should == 15 }
|
14
15
|
its(:preserve_on_altered_tag) { should == false }
|
15
16
|
its(:preserve_on_altered_file) { should == false }
|
16
17
|
its(:read_only) { should == false }
|
@@ -37,7 +38,8 @@ describe Mp3file::ID3v2::FrameHeader do
|
|
37
38
|
describe("A 9-byte TIT2 frame header.") do
|
38
39
|
subject { Mp3file::ID3v2::FrameHeader.new(StringIO.new("TIT2\x00\x00\x00\x09\x00\x00"), tag) }
|
39
40
|
its(:frame_id) { should == 'TIT2' }
|
40
|
-
its(:size) { should ==
|
41
|
+
its(:size) { should == 19 }
|
42
|
+
its(:frame_size) { should == 9 }
|
41
43
|
its(:preserve_on_altered_tag) { should == false }
|
42
44
|
its(:preserve_on_altered_file) { should == false }
|
43
45
|
its(:read_only) { should == false }
|
@@ -52,7 +54,8 @@ describe Mp3file::ID3v2::FrameHeader do
|
|
52
54
|
describe("A TIT2 header with all of its flags set") do
|
53
55
|
subject { Mp3file::ID3v2::FrameHeader.new(StringIO.new("TIT2\x00\x00\x00\x09\x00\x00"), tag) }
|
54
56
|
its(:frame_id) { should == 'TIT2' }
|
55
|
-
its(:size) { should ==
|
57
|
+
its(:size) { should == 19 }
|
58
|
+
its(:frame_size) { should == 9 }
|
56
59
|
its(:preserve_on_altered_tag) { should == false }
|
57
60
|
its(:preserve_on_altered_file) { should == false }
|
58
61
|
its(:read_only) { should == false }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mp3file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Watts
|
@@ -82,6 +82,7 @@ extra_rdoc_files: []
|
|
82
82
|
files:
|
83
83
|
- ".gitattributes"
|
84
84
|
- ".gitignore"
|
85
|
+
- ".travis.yml"
|
85
86
|
- Gemfile
|
86
87
|
- README.md
|
87
88
|
- Rakefile
|