Class: Cyberweb::VideoToHtml
- Inherits:
-
ObtainFilesAndDirectoriesFromThisPath
- Object
- Base
- ObtainFilesAndDirectoriesFromThisPath
- Cyberweb::VideoToHtml
- Defined in:
- lib/cyberweb/utility_scripts/video_to_html/video_to_html.rb
Overview
Cyberweb::VideoToHtml
Constant Summary collapse
- ENGLISH_TITLE =
#
ENGLISH_TITLE
#
'Video files'
- GERMAN_TITLE =
#
GERMAN_TITLE
#
'Video Dateien'
- TRY_TO_USE_THUMBNAILS_FOR_THE_VIDEO =
#
TRY_TO_USE_THUMBNAILS_FOR_THE_VIDEO
If the following constant is set to true then we will use ffmpeg to try to “grab” a meaningful thumbnail for the given video at hand. We will then store this in a directory called thumbnails/.
Note that this will be a conditional check: if the image can not be found at its assumed, default path, then this constant is effectively ignored.
#
true
Constants inherited from ObtainFilesAndDirectoriesFromThisPath
ObtainFilesAndDirectoriesFromThisPath::ARRAY_IMAGES, ObtainFilesAndDirectoriesFromThisPath::BE_VERBOSE, ObtainFilesAndDirectoriesFromThisPath::CSS_STYLE_TO_USE_FOR_THE_TOP_HEADER, ObtainFilesAndDirectoriesFromThisPath::DEFAULT_CSS_STYLE_FOR_HYPERLINKS, ObtainFilesAndDirectoriesFromThisPath::FONT_SIZE_TO_USE, ObtainFilesAndDirectoriesFromThisPath::HTML, ObtainFilesAndDirectoriesFromThisPath::IMG_CSS_STYLE, ObtainFilesAndDirectoriesFromThisPath::INFO_DIRECTORY, ObtainFilesAndDirectoriesFromThisPath::SHALL_WE_DEBUG, ObtainFilesAndDirectoriesFromThisPath::THESE_CSS_CLASSES_ARE_KNOWN_TO_THE_RENDERED_TEMPLATE
Constants inherited from Base
Base::HOME_DIRECTORY_OF_THE_USER_X, Base::NAMESPACE
Class Method Summary collapse
-
.[](i = ARGV) ⇒ Object
# === Cyberweb::VideoToHtml[] ========================================================================= #.
Instance Method Summary collapse
-
#in_total_or_insgesamt ⇒ Object
# === in_total_or_insgesamt ========================================================================= #.
-
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ VideoToHtml
constructor
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#use_which_language? ⇒ Boolean
# === use_which_language? ========================================================================= #.
-
#video_icon? ⇒ Boolean
# === VIDEO_ICON ========================================================================= #.
Methods inherited from ObtainFilesAndDirectoriesFromThisPath
#add, #add_date_in_the_lower_part_of_the_webpage?, #add_hyperlinks_to_subdirectories?, #add_the_footer_with_hyperlinks, #addnl, #append, #append_to_local_css_style, #be_verbose?, #body_css_style?, #check_whether_at_the_least_one_argument_was_given_and_then_act_accordingly, #clear_directories, #clear_files, #colour_for_pdf_files, #consider_appending_the_jquery_string, #content_of_the_HTML_page?, #directory_containing_all_files?, #display_the_top_header?, #do_debug, #do_include_subdirectories, #do_make_use_of_a_go_down_one_level_link, #do_not_include_subdirectories, #do_not_use_HTML_table_layout, #do_open_the_webpage_if_we_are_on_a_roebe_system, #do_process_all_entries_from_this_directory, #do_store_the_content, #do_traverse_into_subdirectories?, #do_use_HTML_table_layout, #files?, #filter_for_these_files, #gold, #include_subdirectories?, #make_use_of_a_go_down_one_level_link?, #mediumorchid, #mediumseagreen, #menu, #n_rows?, #olivedrab, #paleturquoise, #registered_ids?, #report_not_registered_commandline_argument, #report_scanning_directory, #return_early_and_late_year_from_this_array, #return_jquery, #return_the_code_for_going_down_one_level, #return_the_pretty_name_of_the_webpage, #royalblue, #save_into_this_local_file?, #set_background, #set_body_css_style, #set_content_of_the_html_page, #set_directory_containing_all_files, #set_files, #set_save_into_this_local_file, #shall_we_debug?, #show_help, #show_year_in_the_header?, #sort_how?, #use_HTML_table_layout?, #use_german?, #use_jquery?, #use_no_size_value?, #work_on_video_files_only?
Methods inherited from Base
#be_verbose, #be_verbose?, #cascading_style_sheets_directory?, #cd, #commandline_mode?, #copyright?, #css_comment, #delete_directory, #do_toggle, #e, #echo_raw, #filename?, #full_path_to_image_directory?, #html_colours?, #html_image, #htmlentities, #img_dir?, #infer_the_namespace, #initialize_the_configuration, #is_a_file?, #is_a_video_file?, #is_an_image_file?, #is_on_roebe?, #last_tag_used?, #last_tag_used_first_element?, #last_tag_used_id?, #mkdir, #mode?, #namespace?, #open_in_browser, #opne, #opnn, #remove_comments_from_this_string_but_preserve_CSS_rules, #remove_html, #return_all_directories, #return_date, #return_program_name, #return_pwd, #ruby_header?, #server_base_directory?, #set_commandline_mode, #set_last_tag_used, #update_the_image_directory, #use_this_relative_directory_for_custom_images?, #www_mode?
Methods included from BaseModule::FileRelatedFunctionality
#copy_this_file, #cpr, #delete_file, #filename_without_extension?, #read_file_via_utf8_encoding
Methods included from BaseModule
#attach_these_constants, #base_dir?, #beautiful_url, #cd, #create_the_internal_hash, #doctype?, #ee, #ensure_main_encoding, #esystem, #html_templates, #initialize_the_config_if_the_config_hash_is_empty, #internal_hash?, #log_dir?, #no_http, #random_alphabet_characters, #rarrow?, #rds, #remove_comments_from_this_string, #remove_numbers, #require_the_html_templates, #require_these, #return_file_size_in_kb_of, #return_html_comment, #ruby_sitelib_dir?, #sanitize_this_id, #server_base_directory?, #string_remote_image, #today?, #try_to_require_rack, #try_to_require_the_open_gem, #write_what_into
Methods included from BaseModule::ContentType
#content_type_is_html, #content_type_is_jpeg, #content_type_is_json, #content_type_is_plain_text
Methods included from BaseModule::CommandlineArguments
#append_to_the_commandline_arguments, #commandline_arguments?, #first_argument?, #parse_these_commandline_arguments, #second_argument?, #set_commandline_arguments
Methods included from BaseModule::Colours
#all_html_colours, #lightgreen, #rev, #sdir, #sfancy, #sfile, #simp, #steelblue, #tomato
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ VideoToHtml
#
initialize
#
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cyberweb/utility_scripts/video_to_html/video_to_html.rb', line 50 def initialize( commandline_arguments = ARGV, run_already = true ) reset set_commandline_arguments( commandline_arguments ) run if run_already end |
Class Method Details
Instance Method Details
#in_total_or_insgesamt ⇒ Object
#
in_total_or_insgesamt
#
173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/cyberweb/utility_scripts/video_to_html/video_to_html.rb', line 173 def in_total_or_insgesamt case use_which_language? # ======================================================================= # # === :german # ======================================================================= # when :german 'insgesamt' else 'in total' end end |
#reset ⇒ Object
#
reset (reset tag)
#
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/cyberweb/utility_scripts/video_to_html/video_to_html.rb', line 64 def reset super() infer_the_namespace # ======================================================================= # # === @title_to_use # ======================================================================= # @title_to_use = GERMAN_TITLE # ======================================================================= # # Use a white background next: # ======================================================================= # set_body_css_style :default_for_white_background end |
#run ⇒ Object
#
run (run tag)
#
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/cyberweb/utility_scripts/video_to_html/video_to_html.rb', line 87 def run # ← This is necessary so that we can pass options such as --subdirs to this. do_obtain_all_files(:pwd) do_filter_for(:multimedia_files) files = files? files = ::Cyberweb.sort_this_array_by_time(files).reverse # Reverse-sort them by time, always. consider_appending_the_jquery_string # ======================================================================= # # Add the leading <div> tag next: # ======================================================================= # addnl('<div class="rounded_corner" style="color: lightgreen; margin: 8px; background-color: black;">') addnl( HtmlTags.h1( '<img src="https://i.imgur.com/JsyNNkC.png" style="margin-right: 0.4em">'+ @title_to_use+' ('+in_total_or_insgesamt+' '+files.size.to_s+')', 'lightgreen pad12px BG_Black rounded_border' ) ) # ======================================================================= # # Since as of June 2023 we may append another line here. This requires # of this class to find out the name of the directory below the # current directory. # ======================================================================= # if make_use_of_a_go_down_one_level_link? addnl(return_the_code_for_going_down_one_level) end addnl("</div><br>\n") # Close the div-tag here. video_icon = video_icon? files.each_with_index {|this_file, index| index += 1 file_size = (File.size(this_file) / 1024.0 / 1024.0).to_s.to_f.round(2).to_s use_this_description = ''.dup # ===================================================================== # # === Support thumbnails next, if possible # ===================================================================== # if TRY_TO_USE_THUMBNAILS_FOR_THE_VIDEO # =================================================================== # # Here the class will try to obtain a thumbnail for the image. # =================================================================== # target_file = 'thumbnails/thumbnail_for_'+ File.basename(this_file).delete_suffix( File.extname(this_file) )+'.png' if File.exist? target_file use_this_description << ' <img class="round_black1" style="margin-left: 1.8em" src="'+target_file+'">'+"<br>\n" end end use_this_description << video_icon+' → ' use_this_description << File.basename(this_file). tr('_',' '). delete_suffix(File.extname(this_file))+ '<br><b class="darkgreen" style="margin-left: 4em"> [file size: </b>'+ '<b class="darkolivegreen">'+ file_size.to_s+ '</b> <b class="darkgreen">Mb'.dup if Object.const_defined?(:MultimediaParadise) # =================================================================== # # Delegate towards MultimediaParadise.video_resolution() next, to # find out the correct resolution of the video at hand. # =================================================================== # use_this_description << '; Video resolution: '+ MultimediaParadise.video_resolution(this_file).to_s end use_this_description << ']</b><br>' addnl( HtmlTags.a( File.basename(this_file), css_style: 'font-size: 1.2em; color: darkblue; font-weight: bold; margin-left: 1em;', open_new_tab: true, description: use_this_description ) ) addnl('<br>') } do_store_the_content end |
#use_which_language? ⇒ Boolean
#
use_which_language?
#
80 81 82 |
# File 'lib/cyberweb/utility_scripts/video_to_html/video_to_html.rb', line 80 def use_which_language? :german end |
#video_icon? ⇒ Boolean
#
VIDEO_ICON
#
166 167 168 |
# File 'lib/cyberweb/utility_scripts/video_to_html/video_to_html.rb', line 166 def video_icon? '<img src="/home/x/data/images/symbols/video_icon.png" class="marr10px">' end |