wahwah 1.6.5 → 1.6.7
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.
- checksums.yaml +4 -4
- data/lib/wahwah/helper.rb +2 -1
- data/lib/wahwah/mp3_tag.rb +2 -1
- data/lib/wahwah/version.rb +1 -1
- data/lib/wahwah.rb +2 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd618a2efccf772f4c0c768ffb8d51d8ea6cad45ad7cfbd5b467f8a4424ddb2b
|
4
|
+
data.tar.gz: 457b76e752cde40232988efdb38a4ada067309fbf0c120a073859fbe6cd4615f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 494e285e13558dce91912e3c4eb9836e972ddc28c32e3fd1af7ede9b3338f2f0f81e27b132ad8f155f095e1daeb5b45a4fbeb9b013b04820ca8ae1cf260d51c6
|
7
|
+
data.tar.gz: ab5a6344b11b8991ba7db2d9136bd8efe8dbdf008773941e6788ddf9d9055dc71139dd961b0bb6e0873d845997dc625ae69175067061ffa6f4a9a4307b92a952
|
data/lib/wahwah/helper.rb
CHANGED
@@ -54,6 +54,7 @@ module WahWah
|
|
54
54
|
def self.file_format_from_signature(io)
|
55
55
|
io.rewind
|
56
56
|
signature = io.read(16)
|
57
|
+
|
57
58
|
# Rewind after reading the signature to not mess with the file position
|
58
59
|
io.rewind
|
59
60
|
|
@@ -62,7 +63,7 @@ module WahWah
|
|
62
63
|
# M4A is checked for first, since MP4 files start with a chunk size -
|
63
64
|
# and that chunk size may incidentally match another signature.
|
64
65
|
# No other formats would reasonably have "ftyp" as the next for bytes.
|
65
|
-
return "m4a" if ["ftypM4A ".b, "ftyp3gp4".b].include?(signature[4...12])
|
66
|
+
return "m4a" if ["ftypM4A ".b, "ftyp3gp4".b, "ftypmp42".b].include?(signature[4...12])
|
66
67
|
# Handled separately simply because it requires two checks.
|
67
68
|
return "wav" if signature.start_with?("RIFF".b) && signature[8...12] == "WAVE".b
|
68
69
|
magic_numbers = {
|
data/lib/wahwah/mp3_tag.rb
CHANGED
@@ -52,6 +52,7 @@ module WahWah
|
|
52
52
|
def parse_id3_tag
|
53
53
|
@file_io.rewind
|
54
54
|
signature = @file_io.read(6)
|
55
|
+
@file_io.rewind
|
55
56
|
|
56
57
|
if signature.start_with?("ID3".b)
|
57
58
|
id3_v2_tag = ID3::V2.new(@file_io)
|
@@ -72,7 +73,7 @@ module WahWah
|
|
72
73
|
@bitrate = (bytes_count * 8 / @duration / 1000).round unless @duration.zero?
|
73
74
|
else
|
74
75
|
@bitrate = mpeg_frame_header.frame_bitrate
|
75
|
-
@duration = (file_size - (@id3_tag&.size || 0)) * 8 / (@bitrate * 1000).to_f unless @bitrate.zero?
|
76
|
+
@duration = (file_size - (@id3_tag&.size || 0)) * 8 / (@bitrate * 1000).to_f unless @bitrate.to_i.zero?
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
data/lib/wahwah/version.rb
CHANGED
data/lib/wahwah.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "stringio"
|
4
4
|
require "forwardable"
|
5
5
|
require "zlib"
|
6
|
+
require "pathname"
|
6
7
|
|
7
8
|
require "wahwah/version"
|
8
9
|
require "wahwah/errors"
|
@@ -82,7 +83,7 @@ module WahWah
|
|
82
83
|
if path_or_io.is_a? Pathname
|
83
84
|
raise WahWahArgumentError, "File does not exist" unless File.exist? path_or_io
|
84
85
|
raise WahWahArgumentError, "File is unreadable" unless File.readable? path_or_io
|
85
|
-
raise WahWahArgumentError, "File is empty"
|
86
|
+
raise WahWahArgumentError, "File is empty" if File.empty?(path_or_io)
|
86
87
|
|
87
88
|
path_or_io.open do |io|
|
88
89
|
block.call(io, from_path: true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wahwah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aidewoode
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -160,7 +160,7 @@ homepage: https://github.com/aidewoode
|
|
160
160
|
licenses:
|
161
161
|
- MIT
|
162
162
|
metadata: {}
|
163
|
-
post_install_message:
|
163
|
+
post_install_message:
|
164
164
|
rdoc_options: []
|
165
165
|
require_paths:
|
166
166
|
- lib
|
@@ -175,8 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
179
|
-
signing_key:
|
178
|
+
rubygems_version: 3.5.22
|
179
|
+
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Audio metadata reader ruby gem
|
182
182
|
test_files: []
|