Class: MultimediaParadise::CreateVideoThumbnails
- Inherits:
-
Base
- Object
- Base
- MultimediaParadise::CreateVideoThumbnails
show all
- Defined in:
- lib/multimedia_paradise/video/create_video_thumbnails.rb
Overview
Constant Summary
collapse
- DIRECTORY_NAME_FOR_THE_THUMBNAILS =
#
DIRECTORY_NAME_FOR_THE_THUMBNAILS
#
'thumbnails/'
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(commandline_arguments = ARGV, run_already = true) ⇒ CreateVideoThumbnails
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/multimedia_paradise/video/create_video_thumbnails.rb', line 29
def initialize(
commandline_arguments = ARGV,
run_already = true
)
register_sigint
reset
set_commandline_arguments(
commandline_arguments
)
case run_already
when :dont_run_yet,
:do_not_run_yet
run_already = false
end
run if run_already
end
|
Instance Method Details
#do_create_a_video_thumbnail_for_this_file(this_video_file) ⇒ Object
#
do_create_a_video_thumbnail_for_this_file
#
72
73
74
75
76
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
|
# File 'lib/multimedia_paradise/video/create_video_thumbnails.rb', line 72
def do_create_a_video_thumbnail_for_this_file(
this_video_file
)
e DIRECTORY_NAME_FOR_THE_THUMBNAILS+
File.basename(this_video_file)
result = MultimediaParadise.automatically_create_a_thumbnail_for_this_video(this_video_file)
first = result.first
if File.exist? first
move_file(first, thumbnail_dir?)
new_target = thumbnail_dir?+File.basename(first)
_ = ImageParadise.size_of?(new_target)
if _.include?('x')
splitted = _.split('x')
threshold_value = 175
if splitted.first.to_i > threshold_value
e 'The thumbnail of the file '+sfile(new_target)+rev+
' is too large, over '+threshold_value.to_s+rev+
' pixel in width.'
erev 'It will thus be shrunk now.'
_this_file = ImageParadise.shrink_the_width_of_this_image_to_that_width(
new_target,
threshold_value
) { :overwrite_the_old_image }
end
end
end
end
|
#ensure_that_the_thumbnails_directory_exists ⇒ Object
#
ensure_that_the_thumbnails_directory_exists
#
65
66
67
|
# File 'lib/multimedia_paradise/video/create_video_thumbnails.rb', line 65
def ensure_that_the_thumbnails_directory_exists
mkdir(thumbnail_dir?)
end
|
#reset ⇒ Object
49
50
51
52
53
|
# File 'lib/multimedia_paradise/video/create_video_thumbnails.rb', line 49
def reset
super()
infer_the_namespace
set_be_verbose
end
|
#run ⇒ Object
111
112
113
114
115
116
117
118
|
# File 'lib/multimedia_paradise/video/create_video_thumbnails.rb', line 111
def run
ensure_that_the_thumbnails_directory_exists
opne 'Obtaining all video files:'
all_video_files = MultimediaParadise.return_all_video_files_from_the_current_directory
all_video_files.each {|this_video_file|
do_create_a_video_thumbnail_for_this_file(this_video_file)
}
end
|
#thumbnail_dir? ⇒ Boolean