wahwah 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wahwah/lazy_read.rb +15 -2
- data/lib/wahwah/mp3_tag.rb +3 -3
- data/lib/wahwah/mp4/atom.rb +1 -1
- data/lib/wahwah/ogg_tag.rb +4 -12
- data/lib/wahwah/tag.rb +2 -0
- data/lib/wahwah/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e3b8992dca29fbbe7a537a7d2ad23ca0fe33e9596dfbabb5131e615461d22b1
|
4
|
+
data.tar.gz: 58809228e4e9b7f2e40c48136f68cdd2f29939b8628e6690efd75e95cf7c0e88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 501f86ff6b621bfb302b7503e05ef45a472c8faa8c128fc8cb15cf92cb35deca4e828d416bfb0e3bc750f63fb2b299cccabee9d9718729372225edb3e4618f9f
|
7
|
+
data.tar.gz: f1d7c0a92c982180f7041883137b6909c11a761d2da17564aaa4a758297d56db197ae1a1698d3028b8397864ab0673c1f7300acb4bcd6fcfda3d82a6dce1832e
|
data/lib/wahwah/lazy_read.rb
CHANGED
@@ -12,15 +12,28 @@ module WahWah
|
|
12
12
|
@file_io = file_io
|
13
13
|
super(*arg)
|
14
14
|
@position = @file_io.pos
|
15
|
+
@data = get_data if @file_io.is_a?(StringIO)
|
15
16
|
end
|
16
17
|
|
17
18
|
def data
|
18
|
-
@file_io.
|
19
|
-
|
19
|
+
if @file_io.closed? && @file_io.is_a?(File)
|
20
|
+
@file_io = File.open(@file_io.path)
|
21
|
+
@data = get_data
|
22
|
+
@file_io.close
|
23
|
+
end
|
24
|
+
|
25
|
+
@data ||= get_data
|
20
26
|
end
|
21
27
|
|
22
28
|
def skip
|
29
|
+
@file_io.seek(@position)
|
23
30
|
@file_io.seek(size, IO::SEEK_CUR)
|
24
31
|
end
|
32
|
+
|
33
|
+
private
|
34
|
+
def get_data
|
35
|
+
@file_io.seek(@position)
|
36
|
+
@file_io.read(size)
|
37
|
+
end
|
25
38
|
end
|
26
39
|
end
|
data/lib/wahwah/mp3_tag.rb
CHANGED
@@ -38,7 +38,7 @@ module WahWah
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def is_vbr?
|
41
|
-
xing_header.valid? || vbri_header.valid?
|
41
|
+
mpeg_frame_header.valid? && (xing_header.valid? || vbri_header.valid?)
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
@@ -48,8 +48,8 @@ module WahWah
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def parse_id3_tag
|
51
|
-
id3_v1_tag = ID3::V1.new(@file_io)
|
52
|
-
id3_v2_tag = ID3::V2.new(@file_io)
|
51
|
+
id3_v1_tag = ID3::V1.new(@file_io.dup)
|
52
|
+
id3_v2_tag = ID3::V2.new(@file_io.dup)
|
53
53
|
|
54
54
|
return id3_v2_tag if id3_v2_tag.valid?
|
55
55
|
id3_v1_tag if id3_v1_tag.valid?
|
data/lib/wahwah/mp4/atom.rb
CHANGED
data/lib/wahwah/ogg_tag.rb
CHANGED
@@ -16,18 +16,6 @@ module WahWah
|
|
16
16
|
:composer,
|
17
17
|
:sample_rate
|
18
18
|
|
19
|
-
def duration
|
20
|
-
@duration ||= parse_duration
|
21
|
-
end
|
22
|
-
|
23
|
-
def bitrate
|
24
|
-
@bitrate ||= parse_bitrate
|
25
|
-
end
|
26
|
-
|
27
|
-
def bit_depth
|
28
|
-
@bit_depth ||= parse_bit_depth
|
29
|
-
end
|
30
|
-
|
31
19
|
private
|
32
20
|
def packets
|
33
21
|
@packets ||= Ogg::Packets.new(@file_io)
|
@@ -51,6 +39,10 @@ module WahWah
|
|
51
39
|
when identification_packet.start_with?("\x7FFLAC")
|
52
40
|
Ogg::FlacTag.new(identification_packet, comment_packet)
|
53
41
|
end
|
42
|
+
|
43
|
+
@duration = parse_duration
|
44
|
+
@bitrate = parse_bitrate
|
45
|
+
@bit_depth = parse_bit_depth
|
54
46
|
end
|
55
47
|
|
56
48
|
def parse_duration
|
data/lib/wahwah/tag.rb
CHANGED
data/lib/wahwah/version.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aidewoode
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|