module MultimediaParadise::GUI::CutMultimediaModule

Constants

HEIGHT
#

HEIGHT

#
TITLE
#

TITLE

#
USE_THIS_FONT
#

USE_THIS_FONT

#
WIDTH
#

WIDTH

#

Public Instance Methods

a_new_file_has_been_assigned(i) click to toggle source
#

a_new_file_has_been_assigned

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 262
def a_new_file_has_been_assigned(i)
  @cut_multimedia_object.set_work_on_this_file(i)
  set_use_this_file(i)
  update_the_duration
end
border_size?() click to toggle source
#

border_size?

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 49
def border_size?
  2
end
button_commit?()
Alias for: commit_button?
button_trim?() click to toggle source
#

button_trim?

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 98
def button_trim?
  @button_trim
end
Also aliased as: trim_button?
commit_button?() click to toggle source
#

commit_button?

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 133
def commit_button?
  @button_commit
end
Also aliased as: button_commit?
create_the_commit_button() click to toggle source
#

create_the_commit_button (commit tag)

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 118
def create_the_commit_button
  @button_commit = button('_Commit')
  @button_commit.hint = 'Click on this button to cut at the specified start and end positions.'
  @button_commit.bblack2
  @button_commit.on_clicked {
    new_file = do_cut_the_audio_file
    if !uses_gtk3?
      main_entry?.set_text(new_file.to_s)
    end
  }
end
create_the_delete_the_audio_file_button() click to toggle source
#

create_the_delete_the_audio_file_button

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 180
def create_the_delete_the_audio_file_button
  @button_delete_the_audio_file = button('_Delete the audio file')
  @button_delete_the_audio_file.hint = 'Click this button in '\
    'order to delete the audio-file.'
  @button_delete_the_audio_file.on_clicked {
    do_delete_the_audio_file
  }
end
create_the_play_the_audio_file_button() click to toggle source
#

create_the_play_the_audio_file_button

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 105
def create_the_play_the_audio_file_button
  @button_play_the_audio_file = button('_Play the audio file')
  @button_play_the_audio_file.hint = 'Click this button to '\
    'play the audio file. This requires that you have assigned '\
    'a file in the above user-input entry.'
  @button_play_the_audio_file.on_clicked {
    do_play_the_audio_file
  }
end
create_the_trim_button() click to toggle source
#

create_the_trim_button

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 86
def create_the_trim_button
  @button_trim = button('_Trim')
  @button_trim.hint = 'Trim n seconds from the beginning '\
    'of the multimedia file.'
  @button_trim.on_clicked {
    do_trim
  }
end
do_assume_the_duration_as_end_position_if_a_file_has_been_assigned() click to toggle source
#

do_assume_the_duration_as_end_position_if_a_file_has_been_assigned

This method may modify the content of the entry stored under @end_position_entry. This will only work if

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 254
def do_assume_the_duration_as_end_position_if_a_file_has_been_assigned
  _ = duration_of_the_file?
  @end_position_entry.set_text(_.to_s)
end
do_cut_the_audio_file() click to toggle source
#

do_cut_the_audio_file

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 192
def do_cut_the_audio_file
  start_position = @start_position_entry.text?
  end_position   = @end_position_entry.text?
  audio_file_to_use = File.absolute_path(main_file?)
  # ======================================================================= #
  # Navigate to a "safe" directory next:
  # ======================================================================= #
  cd('/tmp/') if File.directory? '/tmp/'
  cd('/home/x/Temp/') if File.directory? '/home/x/Temp/' # This is for my home directory.
  e 'The file `'+sfile(audio_file_to_use.to_s)+'` will be used.'
  _ = MultimediaParadise::CutMultimedia.new(audio_file_to_use, :do_not_run_yet)
  _.assign_this_file(audio_file_to_use)
  _.set_start_position(start_position)
  _.set_end_position(end_position)
  _.do_cut
  result = _.absolute_path_of_the_output_file?
  popup_over_this_widget(
    commit_button?,
    "The new file can now be found at:\n\n  <b>#{result}</b>\n\n"
  ) { :make_selectable } if uses_gtk3?
  return result # Return the file position of the newly created file as well, just in case.
end
do_play_the_audio_file( i = main_file? ) click to toggle source
#

do_play_the_audio_file

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 70
def do_play_the_audio_file(
    i = main_file?
  )
  if i
    @cut_multimedia_object.set_main_file(i)
    Thread.new {
      @cut_multimedia_object.interactive_menu(
        'play_the_audio_file'
      )
    }
  end
end
do_trim() click to toggle source
#

do_trim

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 239
def do_trim
  _ = "trim #{@entry_n_seconds_for_trimming.text?}"
  @cut_multimedia_object.interactive_menu(_)
  this_file = @cut_multimedia_object.output_file?
  set_main_entry(this_file)
  update_the_duration
  @cut_multimedia_object.set_work_on_this_file(this_file)
end
duration?(i) click to toggle source
#

duration?

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 56
def duration?(i)
  ::MultimediaParadise.duration?(i) { :do_not_exit }.to_s
end
duration_of_the_file?() click to toggle source
#

duration_of_the_file?

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 63
def duration_of_the_file?
  duration?(main_file?).to_f # This will always return a Float.
end
main_entry?() click to toggle source
#

main_entry?

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 218
def main_entry?
  @entry_work_on_this_file
end
main_file?() click to toggle source
#

main_file?

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 225
def main_file?
  main_entry?.text?.to_s
end
padding?() click to toggle source
#

padding?

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 42
def padding?
  2
end
return_hbox_containing_the_start_and_end_position_entries() click to toggle source
#

return_hbox_containing_the_start_and_end_position_entries

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 140
def return_hbox_containing_the_start_and_end_position_entries
  hbox = create_hbox
  hbox.minimal(text('Start position:'), 5)
  # ======================================================================= #
  # === @start_position_entry
  # ======================================================================= #
  @start_position_entry = create_entry('0')
  @start_position_entry.light_blue_background
  @start_position_entry.bblack1
  @start_position_entry.center
  @start_position_entry.hint = 'You can provide n seconds, such as '\
                               '20, to start at the 20 seconds mark.'
  hbox.minimal(@start_position_entry, 3)
  hbox.minimal(text('End position:'), 5)
  # ======================================================================= #
  # === @end_position_entry
  # ======================================================================= #
  @end_position_entry = create_entry
  @end_position_entry.light_blue_background
  @end_position_entry.bblack1
  @end_position_entry.center
  @end_position_entry.hint = 'You can provide n seconds, such as '\
                             '20, to end at the 20 seconds mark.'
  hbox.minimal(@end_position_entry, 3)
  hbox.minimal(button_commit?, 3)
  button_merge_the_created_files = button('_Merge the created files')
  button_merge_the_created_files.clear_background
  button_merge_the_created_files.bblack2
  button_merge_the_created_files.css_class('BG_lightgreen')
  button_merge_the_created_files.on_hover_colour(:springgreen)
  button_merge_the_created_files.on_clicked {
    do_merge_the_created_files
  }
  hbox.minimal(button_merge_the_created_files, 3)
  return hbox
end
set_main_entry(i)
Alias for: set_use_this_file
set_use_this_file(i) click to toggle source
#

set_use_this_file

#
# File lib/multimedia_paradise/gui/shared_code/cut_multimedia/cut_multimedia_module.rb, line 232
def set_use_this_file(i)
  main_entry?.set_text(i.to_s)
end
Also aliased as: set_main_entry
trim_button?()
Alias for: button_trim?