module MultimediaParadise::GUI::Gtk::YoutubeDownloaderModule
Constants
- HEIGHT
#¶ ↑
HEIGHT
¶ ↑#¶ ↑
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
- TITLE
#¶ ↑
TITLE
¶ ↑#¶ ↑
- WIDTH
#¶ ↑
WIDTH
¶ ↑#¶ ↑
- WORK_DIRECTORY
#¶ ↑
WORK_DIRECTORY
¶ ↑#¶ ↑
Public Class Methods
[](i = '')
click to toggle source
new( i = nil, run_already = true )
click to toggle source
run()
click to toggle source
#¶ ↑
MultimediaParadise::GUI::Gtk::YoutubeDownloaderModule.run
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/youtube_downloader/youtube_downloader_module.rb, line 329 def self.run require 'gtk_paradise/run' _ = ::MultimediaParadise::GUI::Gtk::YoutubeDownloader.new(ARGV) r = ::Gtk.run r << _ r.set_size_request(_.width?,_.height?) r.automatic_title r.top_left_then_run end
Public Instance Methods
add_to_widget(i)
click to toggle source
border_size?()
click to toggle source
connect_skeleton()
click to toggle source
create_skeleton()
click to toggle source
#¶ ↑
create_skeleton
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/youtube_downloader/youtube_downloader_module.rb, line 253 def create_skeleton create_the_textarea @url_input = gtk_input @url_input.set_size_request(220, 40) _ = 'https://youtube.com/watch?v=...' @url_input.set_placeholder_text(_) @url_input.hint = 'Provide the URL here, which may start like <b>'+_+'</b>.' @button_do_download = gtk_button('Download remote URL') @button_do_download.lightblue @button_do_download.clear_background @button_do_download.bblack1 @button_do_download.on_hover(:mintcream) @button_do_download.hint = '<b>Clicking</b> on this button will download the remote URL '\ 'given. Provide the remote URL in the input-field to '\ 'the <b>left side</b> of this button.' @button_do_download.on_clicked { do_download } hbox = gtk_hbox hbox.maximal(@url_input, 2) hbox.maximal(@button_do_download, 2) minimal(hbox) minimal(@textarea) end
create_the_textarea()
click to toggle source
#¶ ↑
create_the_textarea
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/youtube_downloader/youtube_downloader_module.rb, line 241 def create_the_textarea # ======================================================================= # # === @textarea # ======================================================================= # @textarea = gtk_textarea @textarea.bblack1 @textarea.set_size_request(300, 50) end
do_download( _ = url? )
click to toggle source
#¶ ↑
do_download
¶ ↑
For now we will use youtube-dl for the actual download.
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/youtube_downloader/youtube_downloader_module.rb, line 285 def do_download( _ = url? ) opnn; e "Downloading `#{sfancy(_)}` using youtube-dl." _ = 'youtube-dl '+_ opnn; e _ result = `#{_}` # ======================================================================= # # Next, we will search for [ffmpeg] entries. # ======================================================================= # _ = result.split(N).select {|line| line.include? '[ffmpeg] Merging formats' } _ = _.first regex = /\[ffmpeg\] Merging formats into "(.+)"/ # See: http://rubular.com/r/YYVCi91eTb _.match(regex) set_file_name($1) rename_main_file opnn; e 'The file name is: `'+sfile(file_name?)+'`.' add_to_widget(file_name?) opnn; e 'All done!' end
ensure_that_the_work_directory_exists()
click to toggle source
enter_working_directory()
click to toggle source
file_name?()
click to toggle source
input?()
click to toggle source
opnn()
click to toggle source
padding?()
click to toggle source
rename_main_file()
click to toggle source
#¶ ↑
rename_main_file
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/youtube_downloader/youtube_downloader_module.rb, line 206 def rename_main_file _ = file_name? if file_name?.include? ' ' _.tr!(' ','_') end _.squeeze!('_') if _.include? '__' _.delete!('ó') if _.include? 'ó' _.delete!('(') if _.include? '(' _.delete!(')') if _.include? ')' unless _ == file_name? mv(file_name?, _) set_file_name(_) end end
report_what_directory_will_be_the_working_directory()
click to toggle source
#¶ ↑
report_what_directory_will_be_the_working_directory
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/youtube_downloader/youtube_downloader_module.rb, line 163 def report_what_directory_will_be_the_working_directory opnn; e 'The working directory will be `'+::Colours.sdir(working_directory?)+'`.' end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
# File lib/multimedia_paradise/gui/shared_code/youtube_downloader/youtube_downloader_module.rb, line 76 def reset reset_the_internal_variables # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, NAMESPACE] set_file_name set_use_this_font(:dejavu_condensed_22) # ======================================================================= # # === @title # ======================================================================= # @title = TITLE # ======================================================================= # # === @width # ======================================================================= # set_width(WIDTH) # ======================================================================= # # === @height # ======================================================================= # set_height(HEIGHT) use_gtk_paradise_project_css_file append_project_css_file increase_font_size end
run()
click to toggle source
set_default_gui_font_size( use_this_size = 22 )
click to toggle source
set_file_name(i = nil)
click to toggle source
set_input(i = '')
click to toggle source
url?()
click to toggle source