class MultimediaParadise::Audio::ToMp3
Constants
- BITRATE_TO_USE
#¶ ↑
BITRATE_TO_USE
¶ ↑#¶ ↑
Public Class Methods
Public Instance Methods
filter_away_commandline_arguments_from_this_input(i)
click to toggle source
#¶ ↑
filter_away_commandline_arguments_from_this_input
¶ ↑
We assume the input to this method will be an Array.
#¶ ↑
# File lib/multimedia_paradise/audio/to_mp3.rb, line 50 def filter_away_commandline_arguments_from_this_input(i) selection = i.select {|entry| entry.start_with? '--' } set_commandline_arguments(selection) return i.reject {|entry| entry.start_with? '--' } end
process_the_files( i = @files )
click to toggle source
#¶ ↑
process_the_files
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/audio/to_mp3.rb, line 93 def process_the_files( i = @files ) i.each {|this_file| output_filename = @prepend_this_string_to_the_filename+ File.basename(this_file). sub(/#{File.extname(this_file)}$/,'').delete('()')+ '.mp3' if this_file.include? '(' or this_file.include?(' ') this_file = '"'+this_file+'"' end _ = 'ffmpeg -i '+this_file+ ' -vn -ar 44100 -ac 2 -ab '+BITRATE_TO_USE+' -f mp3 '+ output_filename e "The output file will be called: #{sfile(output_filename)}" e esystem _, colour: :royalblue # <- Pass the command into this system()-variant. e output_filename # <- And return it here. } end
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
Calls superclass method
MultimediaParadise::AudioBase#reset
# File lib/multimedia_paradise/audio/to_mp3.rb, line 37 def reset super() # ======================================================================= # # === @prepend_this_string_to_the_filename # ======================================================================= # @prepend_this_string_to_the_filename = 'output_' end
run()
click to toggle source
set_files(i)
click to toggle source
#¶ ↑
set_files
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/audio/to_mp3.rb, line 59 def set_files(i) i = [i].flatten.compact i = filter_away_commandline_arguments_from_this_input(i) if i and i.is_a?(Array) and i.flatten.empty? # ===================================================================== # # Try to use all .wav files in the current directory in this case. # ===================================================================== # i = Dir['*.wav'] end @files = i end