r2mp3 0.0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +14 -1
- data/example/cli_converter.rb +12 -6
- data/example/example.mp3 +0 -0
- data/example/example1.rb +13 -9
- data/example/example1.wma +0 -0
- data/example/example2.rb +18 -0
- data/example/mp3_dir/example1.mp3 +0 -0
- data/example/mp3_dir/example2.mp3 +0 -0
- data/example/mp3_dir/example3.mp3 +0 -0
- data/example/mp3_dir/example4.mp3 +0 -0
- data/example/wma_dir/example1.wma +0 -0
- data/example/wma_dir/example2.wma +0 -0
- data/example/wma_dir/example3.wma +0 -0
- data/example/wma_dir/example4.wma +0 -0
- data/inspector/mp3inspector.rb +90 -0
- data/lib/r2mp3.rb +84 -20
- metadata +15 -2
data/README
CHANGED
@@ -5,8 +5,21 @@ R2mp3 library:
|
|
5
5
|
|
6
6
|
Requirement:
|
7
7
|
lame_adapter (sudo gem install lame_adapter)
|
8
|
-
mplayer (sudo apt-get install mplayer)
|
8
|
+
mplayer+lame (sudo apt-get install mplayer lame)
|
9
9
|
|
10
10
|
|
11
|
+
Change log:
|
12
|
+
15/10/2007 Pre-Alpha
|
13
|
+
- Should support simple convert to mp3
|
14
|
+
|
15
|
+
29/10/2007 Version 0.1.1
|
16
|
+
- Add bitrate setting
|
17
|
+
- Add mode setting
|
18
|
+
- Remove bitrate setting bug
|
19
|
+
- Change example
|
20
|
+
- Support MP3 to MP3
|
21
|
+
- MP3 inspector added based-on mp3-info
|
22
|
+
|
23
|
+
|
11
24
|
|
12
25
|
|
data/example/cli_converter.rb
CHANGED
@@ -2,10 +2,16 @@
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 'r2mp3'
|
4
4
|
options = Options.new(ARGV)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Converter.new(:convert=>:
|
9
|
-
Converter.new(:convert=>:
|
10
|
-
Converter.new(:convert=>:
|
5
|
+
|
6
|
+
options[:bitrate] ||= 64
|
7
|
+
|
8
|
+
Converter.new(:convert=>:wma,:file=>options[:file],:bitrate => options[:bitrate]){|f| f.to_mp3 } unless options[:wma].nil? or options[:file].nil?
|
9
|
+
Converter.new(:convert=>:wma,:dir=>options[:dir],:bitrate => options[:bitrate]){|d| d.to_mp3 } unless options[:wma].nil? or options[:dir].nil?
|
10
|
+
Converter.new(:convert=>:aac,:file=>options[:file],:bitrate => options[:bitrate]){|f| f.to_mp3 } unless options[:aac].nil? or options[:file].nil?
|
11
|
+
Converter.new(:convert=>:aac,:dir=>options[:dir],:bitrate => options[:bitrate]){|d| d.to_mp3 } unless options[:aac].nil? or options[:dir].nil?
|
12
|
+
Converter.new(:convert=>:ra,:file=>options[:file],:bitrate => options[:bitrate]){|f| f.to_mp3 } unless options[:ra].nil? or options[:file].nil?
|
13
|
+
Converter.new(:convert=>:ra,:dir=>options[:dir],:bitrate => options[:bitrate]){|d| d.to_mp3 } unless options[:ra].nil? or options[:dir].nil?
|
14
|
+
Converter.new(:convert=>:ra,:file=>options[:file],:bitrate => options[:bitrate]){|f| f.to_mp3 } unless options[:mp3].nil? or options[:file].nil?
|
15
|
+
Converter.new(:convert=>:ra,:dir=>options[:dir],:bitrate => options[:bitrate]){|d| d.to_mp3 } unless options[:mp3].nil? or options[:dir].nil?
|
16
|
+
|
11
17
|
|
data/example/example.mp3
ADDED
Binary file
|
data/example/example1.rb
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'rubygems'
|
3
|
-
require 'r2mp3.rb'
|
2
|
+
#require 'rubygems'
|
3
|
+
require '../lib/r2mp3.rb'
|
4
4
|
|
5
|
-
wma_file = "
|
5
|
+
wma_file = "example1.wma"
|
6
6
|
wma_dir = "wma_dir"
|
7
7
|
aac_file = "aac_example.m4a"
|
8
8
|
aac_dir = "aac_dir"
|
9
9
|
rm_file = "rm_example.rm"
|
10
10
|
rm_dir = "rm_dir"
|
11
11
|
|
12
|
-
Converter.new(:convert=>:wma,:file=>wma_file)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Converter.new(:convert=>:
|
12
|
+
Converter.new(:convert=>:wma,:file=>wma_file) do |f|
|
13
|
+
f.bitrate 128
|
14
|
+
f.to_mp3
|
15
|
+
end
|
16
|
+
|
17
|
+
Converter.new(:convert=>:wma,:dir=>wma_dir) do |d|
|
18
|
+
d.bitrate 128
|
19
|
+
d.to_mp3
|
20
|
+
end
|
21
|
+
|
18
22
|
|
Binary file
|
data/example/example2.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#require 'rubygems'
|
3
|
+
require '../lib/r2mp3.rb'
|
4
|
+
|
5
|
+
mp3_file = "example.mp3"
|
6
|
+
mp3_dir = "mp3_dir"
|
7
|
+
|
8
|
+
Converter.new(:convert=>:mp3,:file=>mp3_file) do |f|
|
9
|
+
f.bitrate 160
|
10
|
+
f.to_mp3
|
11
|
+
end
|
12
|
+
|
13
|
+
Converter.new(:convert=>:mp3,:dir=>mp3_dir) do |d|
|
14
|
+
d.bitrate 160
|
15
|
+
d.to_mp3
|
16
|
+
end
|
17
|
+
|
18
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,90 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#This script used for inspect the mp3 file
|
3
|
+
require 'rubygems'
|
4
|
+
require "base64"
|
5
|
+
require 'mp3info'
|
6
|
+
TEMP_FILE = File.join(File.dirname($0),"file.mp3")
|
7
|
+
|
8
|
+
class Mp3Tool
|
9
|
+
def self.setup
|
10
|
+
@valid_mp3 = Base64.decode64 <<EOF
|
11
|
+
//uQZAAAAAAAaQYAAAAAAA0gwAAAAAABpBwAAAAAADSDgAAATEFNRTMuOTNV
|
12
|
+
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
|
13
|
+
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV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artist" => "artist",
|
62
|
+
"album" => "album",
|
63
|
+
"year" => 1921,
|
64
|
+
"comments" => "comments",
|
65
|
+
"genre" => 0,
|
66
|
+
"genre_s" => "Blues",
|
67
|
+
"tracknum" => 36
|
68
|
+
}
|
69
|
+
File.open(TEMP_FILE, "w") { |f| f.write(@valid_mp3) }
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.inspect
|
73
|
+
Mp3Info.open(TEMP_FILE) do |info|
|
74
|
+
puts "Inspecting...#{TEMP_FILE}"
|
75
|
+
puts "======Summary============"
|
76
|
+
puts "MPEG #{info.mpeg_version}"
|
77
|
+
puts "Layer #{info.layer}"
|
78
|
+
puts "VBR? #{info.vbr}"
|
79
|
+
puts "Bitrate #{info.bitrate} kbps"
|
80
|
+
puts "Mode: #{info.channel_mode}"
|
81
|
+
puts "Sample rate #{info.samplerate} Hz"
|
82
|
+
puts "Error protection? #{info.error_protection}"
|
83
|
+
puts "Length #{info.length}"
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
Mp3Tool.setup
|
90
|
+
Mp3Tool.inspect
|
data/lib/r2mp3.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# R2mp3 Library
|
2
|
+
# Exclusive to you by
|
3
|
+
# Warachet Samtalee (zdk@codegent.com)
|
4
|
+
|
1
5
|
require 'rubygems'
|
2
6
|
require 'optparse'
|
3
7
|
require 'optparse/time'
|
@@ -21,12 +25,18 @@ class Options < Hash
|
|
21
25
|
opts.on('-r','--ra-to-mp3','convert .rm to mp3')do
|
22
26
|
self[:ra] = true
|
23
27
|
end
|
28
|
+
opts.on('-m','--mp3-to-mp3','convert mp3 to mp3')do
|
29
|
+
self[:mp3] = true
|
30
|
+
end
|
24
31
|
opts.on('-f','--file [filename]','file') do |f|
|
25
32
|
self[:file] = f
|
26
33
|
end
|
27
34
|
opts.on('-d','--dir [directoryname]','directory') do |d|
|
28
35
|
self[:dir] = d
|
29
36
|
end
|
37
|
+
opts.on('-b','--bitrate [kbps]','bitrate') do |b|
|
38
|
+
self[:bitrate] = b.to_i
|
39
|
+
end
|
30
40
|
opts.on_tail('-h','--help','help') do
|
31
41
|
puts opts
|
32
42
|
exit
|
@@ -51,6 +61,7 @@ end
|
|
51
61
|
class Mplayer
|
52
62
|
# Can be used to dump any audio file to wav
|
53
63
|
def self.dump_to_wav(input, output, opts={})
|
64
|
+
puts "dump to wav"
|
54
65
|
begin
|
55
66
|
platform = `uname -a`
|
56
67
|
binary = "#{%r{Linux} =~ platform}".empty?? "/Applications/mplayer":"mplayer"
|
@@ -72,6 +83,20 @@ class Mplayer
|
|
72
83
|
end
|
73
84
|
|
74
85
|
class Convert
|
86
|
+
|
87
|
+
def self.mp3_to_wav(input, output=nil, opts={})
|
88
|
+
puts "mp3 to wav"
|
89
|
+
conversion(:mp3, :wav, input, output, opts) do | input, output, opts |
|
90
|
+
Mplayer.dump_to_wav(input, output, opts)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.mp3_to_mp3(input, output=nil, opts={})
|
95
|
+
puts "mp3 to mp3"
|
96
|
+
output ||= input.gsub(/\.rm$/,".mp3")
|
97
|
+
mp3_to_wav(input, 'temp.wav', opts) and wav_to_mp3('temp.wav', output, opts.merge({:delete_input=>true}))
|
98
|
+
end
|
99
|
+
|
75
100
|
def self.ra_to_wav(input, output=nil, opts={})
|
76
101
|
conversion(:rm, :wav, input, output, opts) do | input, output, opts |
|
77
102
|
Mplayer.dump_to_wav(input, output, opts)
|
@@ -94,7 +119,8 @@ class Convert
|
|
94
119
|
aac_to_wav(input, 'temp.wav', opts) and wav_to_mp3('temp.wav', output, opts.merge({:delete_input=>true}))
|
95
120
|
end
|
96
121
|
|
97
|
-
def self.wma_to_mp3(input, output=nil, opts={})
|
122
|
+
def self.wma_to_mp3(input, output=nil, opts = {})
|
123
|
+
p opts
|
98
124
|
output ||= input.gsub(/\.wma$/,".mp3")
|
99
125
|
wma_to_wav(input, 'temp.wav', opts) and wav_to_mp3('temp.wav', output, opts.merge({:delete_input=>true}))
|
100
126
|
end
|
@@ -106,13 +132,17 @@ class Convert
|
|
106
132
|
end
|
107
133
|
|
108
134
|
def self.wav_to_mp3(input, output=nil, opts={})
|
135
|
+
puts "wav to mp3"
|
109
136
|
conversion(:wav, :mp3, input, output, opts) do | input, output, opts |
|
110
137
|
opts[:mode] ||= :stereo
|
138
|
+
opts[:bitrate] ||= 64
|
139
|
+
puts "bitrate = #{opts[:bitrate]}"
|
111
140
|
lame = LameAdapter.new
|
112
141
|
lame.input_file input
|
113
142
|
lame.output_file output
|
114
143
|
lame.mode opts[:mode]
|
115
|
-
|
144
|
+
lame.bitrate opts[:bitrate]
|
145
|
+
lame.convert!
|
116
146
|
end
|
117
147
|
end
|
118
148
|
|
@@ -128,82 +158,116 @@ class Convert
|
|
128
158
|
success and File.exists? output_file
|
129
159
|
end
|
130
160
|
|
131
|
-
def self.wma_dir_to_mp3(dirname)
|
161
|
+
def self.wma_dir_to_mp3(dirname, opts = {})
|
132
162
|
Dir["#{dirname}/*.wma"].each do |name|
|
133
163
|
if !name[/[\s]+/].nil? then
|
134
164
|
new_name = name.gsub(" ","_").downcase
|
135
165
|
FileUtils.mv "#{name}", "#{new_name}", :force => true # no error
|
136
166
|
name = new_name
|
137
167
|
end
|
138
|
-
wma_to_mp3(name)
|
168
|
+
wma_to_mp3(name, nil, opts)
|
139
169
|
end
|
140
170
|
end
|
141
171
|
|
142
|
-
def self.wma_file_to_mp3(filename)
|
143
|
-
wma_to_mp3(filename)
|
172
|
+
def self.wma_file_to_mp3(filename, opts = {})
|
173
|
+
wma_to_mp3(filename, nil, opts)
|
144
174
|
end
|
145
175
|
|
146
|
-
def self.aac_dir_to_mp3(dirname)
|
176
|
+
def self.aac_dir_to_mp3(dirname, opts = {})
|
147
177
|
Dir["#{dirname}/*.m4a"].each do |name|
|
148
178
|
if !name[/[\s]+/].nil? then
|
149
179
|
new_name = name.gsub(" ","_").downcase
|
150
180
|
FileUtils.mv "#{name}", "#{new_name}", :force => true # no error
|
151
181
|
name = new_name
|
152
182
|
end
|
153
|
-
aac_to_mp3(name)
|
183
|
+
aac_to_mp3(name, nil, opts)
|
154
184
|
end
|
155
185
|
end
|
156
186
|
|
157
|
-
def self.aac_file_to_mp3(filename)
|
158
|
-
aac_to_mp3(filename)
|
187
|
+
def self.aac_file_to_mp3(filename, opts = {})
|
188
|
+
aac_to_mp3(filename, nil, opts)
|
159
189
|
end
|
160
190
|
|
161
|
-
def self.ra_dir_to_mp3(dirname)
|
191
|
+
def self.ra_dir_to_mp3(dirname, opts = {})
|
162
192
|
Dir["#{dirname}/*.rm"].each do |name|
|
163
193
|
if !name[/[\s]+/].nil? then
|
164
194
|
new_name = name.gsub(" ","_").downcase
|
165
195
|
FileUtils.mv "#{name}", "#{new_name}", :force => true # no error
|
166
196
|
name = new_name
|
167
197
|
end
|
168
|
-
ra_to_mp3(name)
|
198
|
+
ra_to_mp3(name, nil, opts)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def self.ra_file_to_mp3(filename, opts = {})
|
203
|
+
ra_to_mp3(filename, nil, opts)
|
204
|
+
end
|
205
|
+
|
206
|
+
def self.mp3_dir_to_mp3(dirname, opts = {})
|
207
|
+
Dir["#{dirname}/*.mp3"].each do |name|
|
208
|
+
if !name[/[\s]+/].nil? then
|
209
|
+
new_name = name.gsub(" ","_").downcase
|
210
|
+
FileUtils.mv "#{name}", "#{new_name}", :force => true # no error
|
211
|
+
name = new_name
|
212
|
+
end
|
213
|
+
mp3_to_mp3(name, nil, opts)
|
169
214
|
end
|
170
215
|
end
|
171
216
|
|
172
|
-
def self.
|
173
|
-
|
217
|
+
def self.mp3_file_to_mp3(filename, opts = {})
|
218
|
+
mp3_to_mp3(filename, nil, opts)
|
174
219
|
end
|
220
|
+
|
175
221
|
end
|
176
222
|
|
177
223
|
|
178
224
|
class Hash
|
225
|
+
|
179
226
|
def to_mp3
|
180
227
|
case $opts[:convert]
|
181
228
|
when :wma
|
182
229
|
unless $opts[:dir].nil? then
|
183
230
|
puts "convert all wma files in #{self[:dir]}"
|
184
|
-
Convert.wma_dir_to_mp3(self[:dir])
|
231
|
+
Convert.wma_dir_to_mp3(self[:dir], self)
|
185
232
|
else
|
186
233
|
puts "(wma) convert #{self[:file]} to mp3"
|
187
|
-
Convert.wma_file_to_mp3(self[:file])
|
234
|
+
Convert.wma_file_to_mp3(self[:file], self)
|
188
235
|
end
|
189
236
|
when :aac
|
190
237
|
unless $opts[:dir].nil? then
|
191
238
|
puts "convert all aac files in #{self[:dir]}"
|
192
|
-
Convert.aac_dir_to_mp3(self[:dir])
|
239
|
+
Convert.aac_dir_to_mp3(self[:dir], self)
|
193
240
|
else
|
194
241
|
puts "(aac) convert #{self[:file]} to mp3"
|
195
|
-
Convert.aac_file_to_mp3(self[:file])
|
242
|
+
Convert.aac_file_to_mp3(self[:file], self)
|
196
243
|
end
|
197
244
|
when :ra
|
198
245
|
unless $opts[:dir].nil? then
|
199
246
|
puts "convert all ra files in #{self[:dir]}"
|
200
|
-
Convert.ra_dir_to_mp3(self[:dir])
|
247
|
+
Convert.ra_dir_to_mp3(self[:dir], self)
|
201
248
|
else
|
202
249
|
puts "(ra) convert #{self[:file]} to mp3"
|
203
|
-
Convert.ra_file_to_mp3(self[:file])
|
250
|
+
Convert.ra_file_to_mp3(self[:file], self)
|
251
|
+
end
|
252
|
+
when :mp3
|
253
|
+
unless $opts[:dir].nil? then
|
254
|
+
puts "convert all mp3 files in #{self[:dir]}"
|
255
|
+
Convert.mp3_dir_to_mp3(self[:dir], self)
|
256
|
+
else
|
257
|
+
puts "(mp3) convert #{self[:file]} to mp3"
|
258
|
+
Convert.mp3_file_to_mp3(self[:file], self)
|
204
259
|
end
|
205
260
|
end
|
206
261
|
end
|
262
|
+
|
263
|
+
def bitrate kbps
|
264
|
+
self[:bitrate] = kbps
|
265
|
+
end
|
266
|
+
|
267
|
+
def mode m
|
268
|
+
self[:mode] = m
|
269
|
+
end
|
270
|
+
|
207
271
|
end
|
208
272
|
|
209
273
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: r2mp3
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-10-
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2007-10-29 00:00:00 +07:00
|
8
8
|
summary: A library for converting any audio to MP3 (MPEG-1 Layer3)
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -32,10 +32,23 @@ files:
|
|
32
32
|
- README
|
33
33
|
- lib/r2mp3.rb
|
34
34
|
- example/rm_dir
|
35
|
+
- example/example1.wma
|
36
|
+
- example/mp3_dir
|
37
|
+
- example/example.mp3
|
35
38
|
- example/wma_dir
|
36
39
|
- example/aac_dir
|
37
40
|
- example/example1.rb
|
41
|
+
- example/example2.rb
|
38
42
|
- example/cli_converter.rb
|
43
|
+
- example/mp3_dir/example2.mp3
|
44
|
+
- example/mp3_dir/example3.mp3
|
45
|
+
- example/mp3_dir/example1.mp3
|
46
|
+
- example/mp3_dir/example4.mp3
|
47
|
+
- example/wma_dir/example1.wma
|
48
|
+
- example/wma_dir/example3.wma
|
49
|
+
- example/wma_dir/example4.wma
|
50
|
+
- example/wma_dir/example2.wma
|
51
|
+
- inspector/mp3inspector.rb
|
39
52
|
test_files: []
|
40
53
|
|
41
54
|
rdoc_options: []
|