Class: MultimediaParadise::StoreAvailableVideoFiles

Inherits:
Base
  • Object
show all
Defined in:
lib/multimedia_paradise/video/store_available_video_files.rb

Overview

MultimediaParadise::StoreAvailableVideoFiles

Constant Summary collapse

STORE_INTO_THIS_FILE =
#

STORE_INTO_THIS_FILE

#
"#{MultimediaParadise.log_dir?}video_files.md"

Constants inherited from Base

Base::ERROR, Base::ERROR_LINE, Base::NAMESPACE, Base::USE_THIS_NAMESPACE_FOR_THE_COLOURS, Base::USE_THIS_NAMESPACE_FOR_THE_CORE_COLOURS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#actions, #append_what_into, #be_silent, #be_verbose?, #beautiful_url, #cartoons_directory?, #clear_the_internal_hash, #cliner, #cliner_with_time_stamp, #colourized_comment, #copy_file, #crimson, #dataset_from_file_video_collection, #dd_mm_yyyy, #debug?, #default_readlines, #directory_to_realvids?, #do_not_use_opn, #dodgerblue, #does_the_video_player_support_this_commandline?, #e, #ecomment, #ecrimson, #efancy, #enable_debug, #ensure_main_encoding, #ensure_that_the_output_directory_exists, #eparse, #erev, #esystem, #ewarn, #file_video_collection?, #filter_for_audio_files, #filter_for_video_files, #forestgreen, #gold, #grey, #hh_mm_ss, #home_x_video?, #indianred, #infer_the_namespace, #internal_hash?, #is_audio_file?, #is_mkv?, #is_mp3?, #is_mp4?, #is_multimedia_file?, #is_on_roebe?, #is_video_file?, #konsole_colour_peru, #lightblue, #lightgreen, #load_yaml, #local_audio_directory?, #log_dir?, #map_symbol_to_locally_existing_file, #mediumorchid, #mediumpurple, #mediumslateblue, #mkdir, #move_file, #namespace?, #no_file_exists, #no_file_exists_at, #olive, #olivedrab, #opne, #opnecomment, #opnn, #orange, #palegoldenrod, #palegreen, #powderblue, #project_base_directory?, #rds, #register_sigint, #remove_file, #report_pwd, #reset_the_internal_hash, #return_all_video_files, #return_pwd, #return_random_video, #rev, #royalblue, #save_what_into, #sdir, #seagreen, #seconds_to_time_format, #select_only_video_files_from, #set_be_verbose, #set_use_colours, #sfancy, #sfile, #simp, #skyblue, #slateblue, #springgreen, #steelblue, #swarn, #teal, #time_right_now, #to_hh_mm_ss, #tomato, #true_rev, #try_to_rename_kde_konsole_tab, #ucliner, #use_colours?, #use_opn?, #use_which_video_player?, #verbose_truth, #video_collection?, #violet, #yaml_directory?, #yel

Methods included from CommandlineArgumentsModule

#all_input_starts_with_a_number?, #commandline_arguments?, #commandline_arguments_as_a_string, #first_argument?, #first_non_hyphened_commandline_argument?, #set_commandline_arguments

Constructor Details

#initialize(i = ARGV, run_already = true, &block) ⇒ StoreAvailableVideoFiles

#

initialize

#


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/multimedia_paradise/video/store_available_video_files.rb', line 37

def initialize(
    i           = ARGV,
    run_already = true,
    &block
  )
  reset
  set_commandline_arguments(i)
  # ======================================================================= #
  # === Handle blocks given to this method next
  # ======================================================================= #
  if block_given?
    yielded = yield
    case yielded
    # ===================================================================== #
    # === :no_opn
    # ===================================================================== #
    when :no_opn
      do_not_use_opn
    end
  end
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

MultimediaParadise::StoreAvailableVideoFiles[]

#


137
138
139
# File 'lib/multimedia_paradise/video/store_available_video_files.rb', line 137

def self.[](i = ARGV)
  new(i)
end

Instance Method Details

#all_available_videos?Boolean

#

all_available_videos?

#

Returns:

  • (Boolean)


80
81
82
# File 'lib/multimedia_paradise/video/store_available_video_files.rb', line 80

def all_available_videos?
  @all_available_videos
end

#filter_for_video_entriesObject

#

filter_for_video_entries

This method must filter for entries that are video files.

#


73
74
75
# File 'lib/multimedia_paradise/video/store_available_video_files.rb', line 73

def filter_for_video_entries
  all_available_videos?.select! {|entry| is_video_file?(entry)}
end

#gather_all_available_videos(from_this_directory = MultimediaParadise.home_x_video?) ⇒ Object

#

gather_all_available_videos

This method will collect all available video-files.

#


89
90
91
92
93
# File 'lib/multimedia_paradise/video/store_available_video_files.rb', line 89

def gather_all_available_videos(
    from_this_directory = MultimediaParadise.home_x_video?
  )
  @all_available_videos = Dir["#{from_this_directory}**/**"]
end

#resetObject

#

reset (reset tag)

#


63
64
65
66
# File 'lib/multimedia_paradise/video/store_available_video_files.rb', line 63

def reset
  super()
  infer_the_namespace
end

#runObject

#

run (run tag)

#


128
129
130
131
132
# File 'lib/multimedia_paradise/video/store_available_video_files.rb', line 128

def run
  gather_all_available_videos
  filter_for_video_entries
  store_the_results
end

#store_the_resultsObject

#

store_the_results

This method will store the results into a .md file.

#


100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/multimedia_paradise/video/store_available_video_files.rb', line 100

def store_the_results
  ensure_that_the_output_directory_exists
  # ======================================================================= #
  # We aggregate the String that has to be saved into the variable
  # what. This will also include the file-size of the video file
  # at hand.
  # ======================================================================= #
  what = all_available_videos?.map {|entry|
    "#{entry} # file size: #{File.size(entry)}"
  }
  what = what.join(N)
  into = STORE_INTO_THIS_FILE
  opne "#{rev}Now storing into the file at `#{sfile(into)}#{rev}`."
  write_what_into(what, into)
  # ======================================================================= #
  # Also store silently for my home system:
  # ======================================================================= #
  _ = MultimediaParadise.home_x?+'data/personal/video/'
  if File.directory? _
    into = "#{_}#{File.basename(into)}"
    opne "#{rev}Storing into the file at `#{sfile(into)}#{rev}` as well."
    write_what_into(what, into)
  end
end