Class: MultimediaParadise::Video::SmartAnimals
- Inherits:
-
Base
- Object
- Base
- MultimediaParadise::Video::SmartAnimals
show all
- Defined in:
- lib/multimedia_paradise/video/smart_animals/smart_animals.rb
Overview
Constant Summary
collapse
- REGEX_FOR_THE_DESTINATION =
#
REGEX_FOR_THE_DESTINATION
#
/\[download\] Destination: (.+)$/
- REGEX_FOR_THE_MERGING_FORMATS_ENTRY =
#
REGEX_FOR_THE_MERGING_FORMATS_ENTRY
#
/\[Merger\] Merging formats into "(.+)"$/
- ARRAY_URL_OF_VIDEOS_THAT_HAVE_TO_BE_DOWNLOADED =
_.split("\n").map {|entry|
if entry.include? '#' entry = entry.split('#').first.rstrip
end
entry.strip
}.reject {|entry| entry.empty? }
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
#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) ⇒ SmartAnimals
64
65
66
67
68
69
70
71
|
# File 'lib/multimedia_paradise/video/smart_animals/smart_animals.rb', line 64
def initialize(
i = ARGV,
run_already = true
)
reset
set_commandline_arguments(i)
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
182
183
184
|
# File 'lib/multimedia_paradise/video/smart_animals/smart_animals.rb', line 182
def self.[](i = ARGV)
new(i)
end
|
Instance Method Details
#download_via_ytdlp(i) ⇒ Object
Also known as:
download
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'lib/multimedia_paradise/video/smart_animals/smart_animals.rb', line 127
def download_via_ytdlp(i)
if i.is_a? Array
i.each {|entry| download_via_ytdlp(entry) }
else
use_this_command = "yt-dlp #{i}"
e
e violet(" #{use_this_command}")
e
result = `#{use_this_command}`
filename = result.scan(REGEX_FOR_THE_MERGING_FORMATS_ENTRY).flatten.first.to_s
filename = File.absolute_path(filename)
if File.exist? filename
filename = simplify_and_rename_this_filename(filename)
verbose_add_this_file_to_the_main_array(filename)
else
e tomato('No file exists at ')+sfile(filename)
end
end
end
|
#reset ⇒ Object
76
77
78
79
80
81
82
83
|
# File 'lib/multimedia_paradise/video/smart_animals/smart_animals.rb', line 76
def reset
super()
infer_the_namespace
@array_all_local_files = []
end
|
#run ⇒ Object
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/multimedia_paradise/video/smart_animals/smart_animals.rb', line 88
def run
opnn { :no_trailing }
e
e
e '(1) Creating a directory for hosting the videos '\
'showcasing smart animals next:'
_ = "#{log_dir?}smart_animals/"
mkdir(_) { :be_verbose }
e '(2) Navigating to the directory `'+sdir(_)+'`.'
cd(_)
e '(3) Next we will batch-download all these remote videos locally.'
e 'Working through the main list of remote videos/URLs next:'
e
array = array?
download(array)
e
try_to_merge_all_video_files
end
|
#simplify_and_rename_this_filename(filename) ⇒ Object
#
simplify_and_rename_this_filename
#
154
155
156
157
158
159
160
161
|
# File 'lib/multimedia_paradise/video/smart_animals/smart_animals.rb', line 154
def simplify_and_rename_this_filename(filename)
new_filename = File.basename(filename).dup.
tr(' ','_').
delete('[]|')
new_filename = File.absolute_path(new_filename)
rename_file(filename, new_filename)
return new_filename
end
|
#try_to_merge_all_video_files ⇒ Object
#
try_to_merge_all_video_files
#
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/multimedia_paradise/video/smart_animals/smart_animals.rb', line 111
def try_to_merge_all_video_files
e '(4) Merging all local video files next:'
new_filename = File.absolute_path(
MultimediaParadise.merge_these_videos(
@array_all_local_files
)
)
e 'Stored into the following file:'
e
e sfile(" #{new_filename}")
e
end
|
#verbose_add_this_file_to_the_main_array(i) ⇒ Object
#
verbose_add_this_file_to_the_main_array
#
173
174
175
176
177
|
# File 'lib/multimedia_paradise/video/smart_animals/smart_animals.rb', line 173
def verbose_add_this_file_to_the_main_array(i)
e rev+'Adding the file '+sfile(i)+rev+
' to the local array of downloaded video files.'
@array_all_local_files << i
end
|