class MultimediaParadise::MergeAudioFiles

Constants

NAMESPACE
#

NAMESPACE

#

Public Class Methods

[](i = '') click to toggle source
#

MultimediaParadise::MergeAudioFiles[]

#
# File lib/multimedia_paradise/audio/merge_audio_files.rb, line 127
def self.[](i = '')
  new(i)
end
new( commandline_arguments = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/multimedia_paradise/audio/merge_audio_files.rb, line 36
def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

add(this_file) click to toggle source
#

add

This method can be used to add files that are to be merged together.

#
# File lib/multimedia_paradise/audio/merge_audio_files.rb, line 82
def add(this_file)
  @array_merge_these_files << this_file
  @array_merge_these_files.flatten!
end
commandline_arguments?() click to toggle source
#

commandline_arguments?

#
# File lib/multimedia_paradise/audio/merge_audio_files.rb, line 73
def commandline_arguments?
  @commandline_arguments
end
determine_which_files_are_to_be_merged() click to toggle source
#

determine_which_files_are_to_be_merged

#
# File lib/multimedia_paradise/audio/merge_audio_files.rb, line 90
def determine_which_files_are_to_be_merged
  _ = @commandline_arguments.select {|entry|
    File.exist?(entry) and is_an_audio_file?(entry)
  }
  # ======================================================================= #
  # Next, we have to find audio files if the above variable assigned to
  # _ is empty.
  # ======================================================================= #
  if _.empty?
    _ = Dir['**/**'].select {|entry| is_an_audio_file?(entry) }
    unless _.empty?
      opnn; e 'No specific argument was provided. We will thus '+steelblue('scan for')
      opnn; e steelblue('all audio files in this directory and all subdirectories')+
              ' to it'
      opnn; e 'and then merge these together into a new file.'
    end
  end
  add(_)
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method MultimediaParadise::AudioBase#reset
# File lib/multimedia_paradise/audio/merge_audio_files.rb, line 50
def reset
  super()
  # ======================================================================= #
  # === @namespace
  # ======================================================================= #
  @namespace = NAMESPACE
  # ======================================================================= #
  # === @array_merge_these_files
  # ======================================================================= #
  @array_merge_these_files = []
end
run() click to toggle source
#

run (run tag)

#
# File lib/multimedia_paradise/audio/merge_audio_files.rb, line 113
def run
  determine_which_files_are_to_be_merged
  result = MultimediaParadise::MergeMultimedia.new(
    @array_merge_these_files
  )
  output_file = result.output_file?
  if File.exist? output_file
    opnn; e "Merged into the file #{sfile(output_file)}."
  end
end
set_commandline_arguments(i = '') click to toggle source
#

set_input

#
# File lib/multimedia_paradise/audio/merge_audio_files.rb, line 65
def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end