wahwah 1.6.2 → 1.6.4

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
  SHA256:
3
- metadata.gz: b3a02fc03d0532cd3083005e42d0609cc56cec7648027367ba56fa13054538a7
4
- data.tar.gz: df4d540b3bd4a721e99efc02ba19e19f369c1ba58ac6e29c6ad84a22fa6adf34
3
+ metadata.gz: b71422abe8effd7cf724451e130bc68c62e18f89b2a0dbf3af91dd4a789ff7c0
4
+ data.tar.gz: 8e4deef44b33e4112b42b4e0b55d1d850fdf97a6c6041e245fb6a43674c94cf8
5
5
  SHA512:
6
- metadata.gz: 2ce069bbe3e5c1db3735f0aa5cb7de9be1de9f0755b8fdce90a163473039041da63351457149e674a61181840fbe0066032fc03b270c6fca030a3c39ee80b64b
7
- data.tar.gz: c7edf5a8987c8e54e46b521d3650fe84524dda3911e801ba85eb64ab4df4802e6ff43267b2fbca237924cf9eecc2948bd695e3f339cf48cf0f30eef213ee771c
6
+ metadata.gz: 2e46bb17bbda9d55f5999761844924f368fb22836a0029511db9aa57d2447d952803614eda3d0732a0520d9106076c6d97e1f5eadd08d597628975521982ec53
7
+ data.tar.gz: 8f7f7596631653567e8b5661fc1771b6aeeb8def7440da22e580d0453f8c5f40a6f1c330ca28b4f5648b69d21b31df6bf8ce56d7d912941d73f0172b65b00f01
data/lib/wahwah/helper.rb CHANGED
@@ -60,7 +60,7 @@ module WahWah
60
60
  # M4A is checked for first, since MP4 files start with a chunk size -
61
61
  # and that chunk size may incidentally match another signature.
62
62
  # No other formats would reasonably have "ftyp" as the next for bytes.
63
- return "m4a" if signature[4...12] == "ftypM4A ".b
63
+ return "m4a" if ["ftypM4A ".b, "ftyp3gp4".b].include?(signature[4...12])
64
64
  # Handled separately simply because it requires two checks.
65
65
  return "wav" if signature.start_with?("RIFF".b) && signature[8...12] == "WAVE".b
66
66
  magic_numbers = {
@@ -44,7 +44,6 @@ module WahWah
44
44
  # This can often be usefully treated as a four-character field with a mnemonic value .
45
45
  def initialize
46
46
  @size, @type = @file_io.read(HEADER_SIZE)&.unpack("Na4")
47
- return unless valid?
48
47
 
49
48
  # If the size field of an atom is set to 1, the type field is followed by a 64-bit extended size field,
50
49
  # which contains the actual size of the atom as a 64-bit unsigned integer.
@@ -53,6 +52,8 @@ module WahWah
53
52
  # If the size field of an atom is set to 0, which is allowed only for a top-level atom,
54
53
  # designates the last atom in the file and indicates that the atom extends to the end of the file.
55
54
  @size = @file_io.size if @size == 0
55
+ return unless valid?
56
+
56
57
  @size -= HEADER_SIZE
57
58
  end
58
59
 
data/lib/wahwah/tag.rb CHANGED
@@ -3,29 +3,28 @@
3
3
  module WahWah
4
4
  class Tag
5
5
  INTEGER_ATTRIBUTES = %i[disc disc_total track track_total]
6
- INSPECT_ATTRIBUTES = %i[title artist album albumartist composer track track_total genre year disc disc_total]
6
+ INSPECT_ATTRIBUTES = %i[
7
+ title
8
+ artist
9
+ album
10
+ albumartist
11
+ composer
12
+ comments
13
+ track
14
+ track_total
15
+ genre
16
+ year
17
+ disc
18
+ disc_total
19
+ lyrics
20
+ duration
21
+ bitrate
22
+ sample_rate
23
+ bit_depth
24
+ file_size
25
+ ]
7
26
 
8
- attr_reader(
9
- :title,
10
- :artist,
11
- :album,
12
- :albumartist,
13
- :composer,
14
- :comments,
15
- :track,
16
- :track_total,
17
- :genre,
18
- :year,
19
- :disc,
20
- :disc_total,
21
- :lyrics,
22
- :duration,
23
- :bitrate,
24
- :sample_rate,
25
- :bit_depth,
26
- :file_size,
27
- :from_path
28
- )
27
+ attr_reader(*INSPECT_ATTRIBUTES)
29
28
 
30
29
  def initialize(io, from_path: false)
31
30
  @from_path = from_path
@@ -45,7 +44,7 @@ module WahWah
45
44
 
46
45
  def inspect
47
46
  inspect_id = ::Kernel.format "%x", (object_id * 2)
48
- inspect_attributes_values = INSPECT_ATTRIBUTES.map { |attr_name| "#{attr_name}=#{send(attr_name)}" }.join(" ")
47
+ inspect_attributes_values = INSPECT_ATTRIBUTES.map { |attr_name| "#{attr_name}: #{send(attr_name).inspect}" }.join(", ")
49
48
 
50
49
  "<#{self.class.name}:0x#{inspect_id} #{inspect_attributes_values}>"
51
50
  end
@@ -60,6 +59,8 @@ module WahWah
60
59
 
61
60
  private
62
61
 
62
+ attr_accessor :from_path
63
+
63
64
  def parse
64
65
  raise WahWahNotImplementedError, "The parse method is not implemented"
65
66
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WahWah
4
- VERSION = "1.6.2"
4
+ VERSION = "1.6.4"
5
5
  end
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.2
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - aidewoode
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-11 00:00:00.000000000 Z
11
+ date: 2024-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.3.27
178
+ rubygems_version: 3.4.19
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Audio metadata reader ruby gem