wahwah 0.1.0.pre.test

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WahWah
4
+ class Tag
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 duration bitrate sample_rate)
7
+
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
+ :images,
22
+ :duration,
23
+ :bitrate,
24
+ :sample_rate,
25
+ :file_size
26
+ )
27
+
28
+ def initialize(file)
29
+ if file.is_a?(IO) || file.is_a?(StringIO)
30
+ @file_size = file.size
31
+ @file_io = file
32
+ else
33
+ @file_size = File.size(file)
34
+ @file_io = File.open(file)
35
+ end
36
+
37
+ @comments = []
38
+ @images = []
39
+
40
+ parse if @file_size > 0
41
+
42
+ INTEGER_ATTRIBUTES.each do |attr_name|
43
+ value = instance_variable_get("@#{attr_name}")&.to_i
44
+ instance_variable_set("@#{attr_name}", value)
45
+ end
46
+ end
47
+
48
+ def parse
49
+ raise WahWahNotImplementedError, 'The parse method is not implemented'
50
+ end
51
+
52
+ def inspect
53
+ inspect_id = ::Kernel.format '%x', (object_id * 2)
54
+ inspect_attributes_values = INSPECT_ATTRIBUTES.map { |attr_name| "#{attr_name}=#{self.send(attr_name)}" }.join(' ')
55
+
56
+ "<#{self.class.name}:0x#{inspect_id} #{inspect_attributes_values}>"
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WahWah
4
+ module TagDelegate
5
+ def tag_delegate(accessor, *attributes)
6
+ attributes.each do |attr|
7
+ define_method(attr) do
8
+ tag = instance_variable_get(accessor)
9
+
10
+ return super() if tag.nil?
11
+ tag.send(attr)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WahWah
4
+ VERSION = '0.1.0-test'
5
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wahwah
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre.test
5
+ platform: ruby
6
+ authors:
7
+ - aidewoode
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-07-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.80.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.80.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-performance
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.5.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.5.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: codecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.1.17
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.1.17
97
+ description: WahWah is an audio metadata reader ruby gem, it supports many popular
98
+ formats including mp3(ID3 v1, v2.2, v2.3, v2.4), m4a, ogg, oga, opus, wav, flac
99
+ and wma.
100
+ email:
101
+ - aidewoode@gmail.com
102
+ executables: []
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - LICENSE
107
+ - lib/wahwah.rb
108
+ - lib/wahwah/asf/object.rb
109
+ - lib/wahwah/asf_tag.rb
110
+ - lib/wahwah/errors.rb
111
+ - lib/wahwah/flac/block.rb
112
+ - lib/wahwah/flac/streaminfo_block.rb
113
+ - lib/wahwah/flac_tag.rb
114
+ - lib/wahwah/helper.rb
115
+ - lib/wahwah/id3/comment_frame_body.rb
116
+ - lib/wahwah/id3/frame.rb
117
+ - lib/wahwah/id3/frame_body.rb
118
+ - lib/wahwah/id3/genre_frame_body.rb
119
+ - lib/wahwah/id3/image_frame_body.rb
120
+ - lib/wahwah/id3/text_frame_body.rb
121
+ - lib/wahwah/id3/v1.rb
122
+ - lib/wahwah/id3/v2.rb
123
+ - lib/wahwah/id3/v2_header.rb
124
+ - lib/wahwah/mp3/mpeg_frame_header.rb
125
+ - lib/wahwah/mp3/vbri_header.rb
126
+ - lib/wahwah/mp3/xing_header.rb
127
+ - lib/wahwah/mp3_tag.rb
128
+ - lib/wahwah/mp4/atom.rb
129
+ - lib/wahwah/mp4_tag.rb
130
+ - lib/wahwah/ogg/flac_tag.rb
131
+ - lib/wahwah/ogg/opus_tag.rb
132
+ - lib/wahwah/ogg/packets.rb
133
+ - lib/wahwah/ogg/page.rb
134
+ - lib/wahwah/ogg/pages.rb
135
+ - lib/wahwah/ogg/vorbis_comment.rb
136
+ - lib/wahwah/ogg/vorbis_tag.rb
137
+ - lib/wahwah/ogg_tag.rb
138
+ - lib/wahwah/riff/chunk.rb
139
+ - lib/wahwah/riff_tag.rb
140
+ - lib/wahwah/tag.rb
141
+ - lib/wahwah/tag_delegate.rb
142
+ - lib/wahwah/version.rb
143
+ homepage: https://github.com/aidewoode
144
+ licenses:
145
+ - MIT
146
+ metadata: {}
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: 2.5.0
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">"
159
+ - !ruby/object:Gem::Version
160
+ version: 1.3.1
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 2.7.6.2
164
+ signing_key:
165
+ specification_version: 4
166
+ summary: Audio metadata reader ruby gem
167
+ test_files: []