class MultimediaParadise::VideoMetadata

Constants

NAMESPACE
#

MultimediaParadise::VideoMetadata::NAMESPACE

#
STORE_INTO_THIS_FILE
#

STORE_INTO_THIS_FILE

Where to store the information about a video file.

#

Public Class Methods

new( this_file = ARGV, run_already = true ) click to toggle source
#

initialize

#
# File lib/multimedia_paradise/video/video_metadata.rb, line 34
def initialize(
    this_file   = ARGV,
    run_already = true
  )
  reset
  set_main_file(this_file)
  run if run_already
end

Public Instance Methods

delete_old_file_if_it_exists(i = store_where?) click to toggle source
#

delete_old_file_if_it_exists

#
# File lib/multimedia_paradise/video/video_metadata.rb, line 57
def delete_old_file_if_it_exists(i = store_where?)
  if File.exist? i # This must then be an old file.
    File.delete(i)
  end
end
input_file?()
Alias for: main_file?
main_file?() click to toggle source
#

main_file?

#
# File lib/multimedia_paradise/video/video_metadata.rb, line 112
def main_file?
  @main_file
end
Also aliased as: input_file?
prepend_filename() click to toggle source
#

prepend_filename

This method will prepend the filename into the file.

It will use SaveFile for storing said content.

#
# File lib/multimedia_paradise/video/video_metadata.rb, line 70
def prepend_filename
  dataset = read_from_main_file
  dataset.prepend 'Filename: '+@main_file+N
  write_what_into(dataset, store_where?)
end
read_from_main_file() click to toggle source
#

read_from_main_file

#
# File lib/multimedia_paradise/video/video_metadata.rb, line 79
def read_from_main_file
  File.read(store_where?)
end
reset() click to toggle source
#

reset

#
Calls superclass method MultimediaParadise::Base#reset
# File lib/multimedia_paradise/video/video_metadata.rb, line 46
def reset
  super()
  # ======================================================================= #
  # === @namespace
  # ======================================================================= #
  @namespace = NAMESPACE
end
run() click to toggle source
#

run

#
# File lib/multimedia_paradise/video/video_metadata.rb, line 119
def run
  delete_old_file_if_it_exists
  _ = 'ffmpeg -i '+@main_file+' -f ffmetadata '+store_where?
  esystem _
  prepend_filename
  show_content
  opnn; e 'Stored into file `'+sfile(store_where?)+'`.'
end
set_main_file(i) click to toggle source
#

set_main_file

#
# File lib/multimedia_paradise/video/video_metadata.rb, line 104
def set_main_file(i)
  i = i.join(' ').strip if i.is_a? Array
  @main_file = i
end
show_content() click to toggle source
#

show_content

Display the content to the user.

#
# File lib/multimedia_paradise/video/video_metadata.rb, line 88
def show_content
  opnn; e 'We have gathered this information about the file '+
           sfile(input_file?)+':'
  e simp(read_from_main_file.chomp)
end
store_where?() click to toggle source
#

store_where?

#
# File lib/multimedia_paradise/video/video_metadata.rb, line 97
def store_where?
  STORE_INTO_THIS_FILE
end