Class: MultimediaParadise::Multimedia::VideoDownloader
- Inherits:
-
Base
- Object
- Base
- MultimediaParadise::Multimedia::VideoDownloader
show all
- Defined in:
- lib/multimedia_paradise/multimedia/video_downloader/video_downloader.rb
Overview
Constant Summary
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
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(this_file = ARGV, run_already = true) ⇒ VideoDownloader
24
25
26
27
28
29
30
31
|
# File 'lib/multimedia_paradise/multimedia/video_downloader/video_downloader.rb', line 24
def initialize(
this_file = ARGV,
run_already = true
)
reset
set_this_file(this_file)
run if run_already
end
|
Instance Method Details
#do_download_the_remote_video(i = which_file?,
, special_key_to_use_for_a_hash = 'url') ⇒ Object
#
do_download_the_remote_video
#
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/multimedia_paradise/multimedia/video_downloader/video_downloader.rb', line 77
def do_download_the_remote_video(
i = which_file?,
special_key_to_use_for_a_hash = 'url'
)
if i and File.exist?(i)
if i.end_with?('.yml') dataset = load_yaml(i)
_ = []
if dataset.is_a? Hash
dataset.each_pair {|key, inner_hash|
if inner_hash.has_key? special_key_to_use_for_a_hash
remote_URL = inner_hash[special_key_to_use_for_a_hash]
_ << remote_URL
end
}
end
dataset = _ unless _.empty?
else
dataset = File.readlines(i)
end
ensure_that_the_output_directory_exists
cd log_directory?
mkdir('downloaded_videos/') if return_pwd.include? log_dir?
cd 'downloaded_videos/'
opnn; e 'Proceeding to batch-download the videos next, from '\
'the'
opnn; e 'local directory `'+sdir(return_pwd)+'`.'
e
array_results = []
dataset.each {|this_remote_URL|
opnn; e 'Working on '+steelblue(this_remote_URL)+' next ...'
opnn; e '(This may take a while.)'
cmd_to_use = "youtube-dl #{this_remote_URL}"
result = `#{cmd_to_use}`
array_results << result
}
opnn; e 'Results were:'
pp array_results
if is_on_roebe? and return_pwd.include?(log_dir?)
opnn; e 'Trying to remove all " " characters from files next.'
require 'roebe/classes/replace_space_with_underscore/replace_space_with_underscore.rb'
Roebe.replace_space_with_underscore('--everything')
end
else
end
end
|
#file? ⇒ Boolean
Also known as:
which_file?
70
71
72
|
# File 'lib/multimedia_paradise/multimedia/video_downloader/video_downloader.rb', line 70
def file?
@this_file
end
|
#reset ⇒ Object
36
37
38
39
|
# File 'lib/multimedia_paradise/multimedia/video_downloader/video_downloader.rb', line 36
def reset
super()
infer_the_namespace
end
|
#run ⇒ Object
127
128
129
|
# File 'lib/multimedia_paradise/multimedia/video_downloader/video_downloader.rb', line 127
def run
do_download_the_remote_video
end
|
#set_this_file(i) ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/multimedia_paradise/multimedia/video_downloader/video_downloader.rb', line 44
def set_this_file(i)
i = i.first if i.is_a? Array
case i when :ruck_zuck
i = yaml_directory?+
'game_shows/ruck_zuck/ruck_zuck.yml'
when :tales_from_the_crypt,
:tales
i = yaml_directory?+
'tales_from_the_crypt/tales_from_the_crypt.yml'
end
@this_file = i
end
|