wahwah 1.3.0 → 1.5.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
  SHA256:
3
- metadata.gz: ac83f92fa8a66210ab41b57ab7ccac87f7653573860286a5986ffc17132a57eb
4
- data.tar.gz: d197f0523c55af55ef826237b227e21d450b13937585eaa456e18360ae1983e6
3
+ metadata.gz: 02bf7083fb530d058140db0b5f5e18cf2710ba7a6ba7fed2d2978c2109764ab2
4
+ data.tar.gz: dc9a32191879dfda4ea08477579ec4c631be6f0829d25ad066623232cd926a15
5
5
  SHA512:
6
- metadata.gz: d9e893bb99650e639f26546705d0d46bdba50da7377bd11f221247adc1069e97738ad2a4ed134fa078682ccf51cc13a37bf1bb2bebee3891e26de662e0f887cc
7
- data.tar.gz: 1bf025ffb3ef82c4870477402befafaedb5c1c654726ba77f61c88d7ef8d6516f6d56c79cf54fc45f319a56d97402f0061d8c5c0e20e3e274afc8d40080e4522
6
+ metadata.gz: 59b2cd82d8d52b273bb2abfa4085a083716fb9cb701102c0103e6ccf2a08b3909253c8bda2ffe2d423bed43a056a8aab1bd7d3c172468c6f72fa7dafc4879b56
7
+ data.tar.gz: 578a61f74b3eea858ba31817d8d16e663b3e7680806886e2e44fc7b4c93b09b601a5559c07326f63cc0e43a6be2c1d362e6247297679e65578e301f0f7c591ee
@@ -17,7 +17,8 @@ module WahWah
17
17
  "WM/Genre" => :genre,
18
18
  "WM/PartOfSet" => :disc,
19
19
  "WM/TrackNumber" => :track,
20
- "WM/Year" => :year
20
+ "WM/Year" => :year,
21
+ "WM/Lyrics" => :lyrics
21
22
  }
22
23
 
23
24
  private
@@ -18,6 +18,7 @@ module WahWah
18
18
  TP2: :albumartist,
19
19
  TCM: :composer,
20
20
  PIC: :image,
21
+ ULT: :lyrics,
21
22
 
22
23
  # ID3v2.3 and ID3v2.4 frame id
23
24
  COMM: :comment,
@@ -31,6 +32,7 @@ module WahWah
31
32
  TPE2: :albumartist,
32
33
  TCOM: :composer,
33
34
  APIC: :image,
35
+ USLT: :lyrics,
34
36
 
35
37
  # ID3v2.4 use TDRC replace TYER
36
38
  TDRC: :year
@@ -167,6 +169,8 @@ module WahWah
167
169
  GenreFrameBody
168
170
  when :image
169
171
  ImageFrameBody
172
+ when :lyrics
173
+ LyricsFrameBody
170
174
  else
171
175
  TextFrameBody
172
176
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WahWah
4
+ module ID3
5
+ class LyricsFrameBody < CommentFrameBody
6
+ end
7
+ end
8
+ end
@@ -23,7 +23,8 @@ module WahWah
23
23
  :year,
24
24
  :disc,
25
25
  :disc_total,
26
- :images
26
+ :images,
27
+ :lyrics
27
28
 
28
29
  def id3v2?
29
30
  @id3_tag.instance_of? ID3::V2
@@ -10,6 +10,7 @@ module WahWah
10
10
  "\xA9day".b => :year,
11
11
  "\xA9gen".b => :genre,
12
12
  "\xA9nam".b => :title,
13
+ "\xA9lyr".b => :lyrics,
13
14
  "covr".b => :image,
14
15
  "disk".b => :disc,
15
16
  "trkn".b => :track,
@@ -125,9 +126,22 @@ module WahWah
125
126
 
126
127
  mp4a_atom = atom.find("mp4a")
127
128
  esds_atom = atom.find("esds")
129
+ alac_atom = atom.find("alac")
128
130
 
129
131
  @sample_rate = mp4a_atom.data.unpack1("x22I>") if mp4a_atom.valid?
130
132
  @bitrate = esds_atom.data.unpack1("x26I>") / 1000 if esds_atom.valid?
133
+
134
+ # see https://github.com/macosforge/alac/blob/master/ALACMagicCookieDescription.txt for more info.
135
+ if alac_atom.valid?
136
+ atom_data = StringIO.new(alac_atom.data)
137
+
138
+ atom_data.seek(45, IO::SEEK_CUR)
139
+ @bit_depth = atom_data.read(1).unpack1("C")
140
+
141
+ atom_data.seek(10, IO::SEEK_CUR)
142
+ @bitrate = (atom_data.read(4).unpack1("I>") / 1000.to_f).round
143
+ @sample_rate = atom_data.read(4).unpack1("I>")
144
+ end
131
145
  end
132
146
 
133
147
  def parse_image_data(image_data_atom)
@@ -24,7 +24,8 @@ module WahWah
24
24
  "DATE" => :year,
25
25
  "GENRE" => :genre,
26
26
  "DISCNUMBER" => :disc,
27
- "COMPOSER" => :composer
27
+ "COMPOSER" => :composer,
28
+ "LYRICS" => :lyrics
28
29
  }
29
30
 
30
31
  def parse_vorbis_comment(comment_content)
@@ -14,7 +14,8 @@ module WahWah
14
14
  :genre,
15
15
  :disc,
16
16
  :composer,
17
- :sample_rate
17
+ :sample_rate,
18
+ :lyrics
18
19
 
19
20
  private
20
21
 
@@ -109,17 +109,18 @@ module WahWah
109
109
  # And INFO chunk as a subchunk for LIST chunk.
110
110
  if chunk.type != "INFO"
111
111
  chunk.skip
112
- else
113
- until list_chunk_end_position <= @file_io.pos
114
- info_chunk = Riff::Chunk.new(@file_io)
112
+ return
113
+ end
115
114
 
116
- unless INFO_ID_MAPPING.key? info_chunk.id.to_sym
117
- info_chunk.skip
118
- next
119
- end
115
+ until list_chunk_end_position <= @file_io.pos
116
+ info_chunk = Riff::Chunk.new(@file_io)
120
117
 
121
- update_attribute(info_chunk)
118
+ unless INFO_ID_MAPPING.key? info_chunk.id.to_sym
119
+ info_chunk.skip
120
+ next
122
121
  end
122
+
123
+ update_attribute(info_chunk)
123
124
  end
124
125
  end
125
126
 
data/lib/wahwah/tag.rb CHANGED
@@ -18,6 +18,7 @@ module WahWah
18
18
  :year,
19
19
  :disc,
20
20
  :disc_total,
21
+ :lyrics,
21
22
  :duration,
22
23
  :bitrate,
23
24
  :sample_rate,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WahWah
4
- VERSION = "1.3.0"
4
+ VERSION = "1.5.0"
5
5
  end
data/lib/wahwah.rb CHANGED
@@ -20,6 +20,7 @@ require "wahwah/id3/text_frame_body"
20
20
  require "wahwah/id3/genre_frame_body"
21
21
  require "wahwah/id3/comment_frame_body"
22
22
  require "wahwah/id3/image_frame_body"
23
+ require "wahwah/id3/lyrics_frame_body"
23
24
 
24
25
  require "wahwah/mp3/mpeg_frame_header"
25
26
  require "wahwah/mp3/xing_header"
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.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aidewoode
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-22 00:00:00.000000000 Z
11
+ date: 2023-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.21.2
75
+ version: 0.22.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.21.2
82
+ version: 0.22.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov-lcov
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -131,6 +131,7 @@ files:
131
131
  - lib/wahwah/id3/frame_body.rb
132
132
  - lib/wahwah/id3/genre_frame_body.rb
133
133
  - lib/wahwah/id3/image_frame_body.rb
134
+ - lib/wahwah/id3/lyrics_frame_body.rb
134
135
  - lib/wahwah/id3/text_frame_body.rb
135
136
  - lib/wahwah/id3/v1.rb
136
137
  - lib/wahwah/id3/v2.rb
@@ -167,14 +168,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
168
  requirements:
168
169
  - - ">="
169
170
  - !ruby/object:Gem::Version
170
- version: 2.6.0
171
+ version: 2.7.0
171
172
  required_rubygems_version: !ruby/object:Gem::Requirement
172
173
  requirements:
173
174
  - - ">="
174
175
  - !ruby/object:Gem::Version
175
176
  version: '0'
176
177
  requirements: []
177
- rubygems_version: 3.2.32
178
+ rubygems_version: 3.3.26
178
179
  signing_key:
179
180
  specification_version: 4
180
181
  summary: Audio metadata reader ruby gem