class MultimediaParadise::ToOgg

Public Class Methods

new( i = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/multimedia_paradise/audio/to_ogg.rb, line 23
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input(i)
  run if run_already
end

Public Instance Methods

cleanup_old_files() click to toggle source
#

cleanup_old_files

#
# File lib/multimedia_paradise/audio/to_ogg.rb, line 72
def cleanup_old_files
  if File.exist? output_file?
    File.delete(output_file?)
  end
end
input?() click to toggle source
#

input?

#
# File lib/multimedia_paradise/audio/to_ogg.rb, line 51
def input?
  @input
end
output_file?() click to toggle source
#

output_file?

#
# File lib/multimedia_paradise/audio/to_ogg.rb, line 65
def output_file?
  'output_'+return_input_name+'.ogg'
end
report_that_we_are_done_now() click to toggle source
#

report_that_we_are_done_now

#
# File lib/multimedia_paradise/audio/to_ogg.rb, line 81
def report_that_we_are_done_now
  e "Finished creating the file #{sfile(output_file?)}"
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method MultimediaParadise::AudioBase#reset
# File lib/multimedia_paradise/audio/to_ogg.rb, line 35
def reset
  super()
end
return_input_name() click to toggle source
#

return_input_name

#
# File lib/multimedia_paradise/audio/to_ogg.rb, line 58
def return_input_name
  input?.gsub(/#{File.extname(input?)}$/, '')
end
run() click to toggle source
#

run (run tag)

#
# File lib/multimedia_paradise/audio/to_ogg.rb, line 88
def run
  cleanup_old_files
  _ = 'ffmpeg'.dup
  _ << ' -i '+input?
  _ << ' -strict -2' # So that ffmpeg does not complain about vorbis being experimental.
  _ << ' -acodec libvorbis'
  _ << ' -aq 100 '
  _ << output_file? 
  esystem _
  report_that_we_are_done_now
end
set_input(i = '') click to toggle source
#

set_input

#
# File lib/multimedia_paradise/audio/to_ogg.rb, line 42
def set_input(i = '')
  i = i.first if i.is_a? Array
  i = i.to_s.dup if i
  @input = i
end