wahwah 1.4.0 → 1.5.1

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: c89f381ce92eb4aef78be550c4d94ab8240aca8eb73668a3665ab4a13b1b4a05
4
- data.tar.gz: f96620760e75d4675540394e6a09699872b882e9472b609ca9fa89461718bb2e
3
+ metadata.gz: 0ae84eaac046bfc70016dd80a23f1c246066d70264c064fd048127946a40bd51
4
+ data.tar.gz: bea598207d92e57cac06bfc948b1ea86a70b68b7ffd61c2231a5b2f75d193785
5
5
  SHA512:
6
- metadata.gz: aa56fddf36105d9ffe48174a448242c48e89473316d469589cfcfd6bd89dfa014b78a2ffac3b7b65cf0ff4afa75eb53ccb1114196f621828fecec4960f64ac36
7
- data.tar.gz: a096bd36dd4a29d180faa55b6a06e4fbcb3ada6beb1592f37c15dfab84744c7f4850b5810620cc22909b76c30f75594a055eb11a55dec760c09c5a70c650332c
6
+ metadata.gz: cc3e3ad5fb44882840f7fe1d21d77aa722a0bc5b13ef41b1d8243f6dc24ec83ac83ce2765e5941f09e7e097b458810235f11235d6b9b997623b9910082d8e023
7
+ data.tar.gz: 4f5fd37cbe0eadfec74eae4b73952bd9fe03b5a8ce67569c4662f54e142a33a163c94722257b6d461286b537b7c59cd0c52b33728659f606d1a1219b10332e00
@@ -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,
@@ -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
 
@@ -95,6 +95,12 @@ module WahWah
95
95
  def parse_fmt_chunk(chunk)
96
96
  _, @channel, @sample_rate, _, _, @bit_depth = chunk.data.unpack("vvVVvv")
97
97
  @bitrate = @sample_rate * @channel * @bit_depth / 1000
98
+
99
+ # There is a rare situation where the data chunk is not included in the top RIFF chunk.
100
+ # In this case, the duration can not be got from the data chunk, some player even cannot play the file.
101
+ # So try to estimate the duration from the file size and bitrate.
102
+ # This may be inaccurate, but at least can get approximate duration.
103
+ @duration = (@file_size * 8) / (@bitrate * 1000).to_f if @duration.nil?
98
104
  end
99
105
 
100
106
  def parse_data_chunk(chunk)
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.4.0"
4
+ VERSION = "1.5.1"
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.4.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - aidewoode
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-15 00:00:00.000000000 Z
11
+ date: 2023-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -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