Class: MultimediaParadise::GUI::UniversalWidgets::Radio

Inherits:
Base
  • Object
show all
Includes:
UniversalWidgets::BaseModule
Defined in:
lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb

Overview

MultimediaParadise::GUI::UniversalWidgets::Radio

Constant Summary collapse

TITLE =
#

TITLE

#
'Radio'
HOMEPAGE_OF_THIS_PROJECT =
#

HOMEPAGE_OF_THIS_PROJECT

#
'https://rubygems.org/gems/multimedia_paradise'
WIDTH =
#

WIDTH

#
'100% or minimum 1820px'
HEIGHT =
#

HEIGHT

#
'88% or minimum 1540px'
DEFAULT_STREAM =
#

DEFAULT_STREAM

#
'https://orf-live.ors-shoutcast.at/oe3-q2a.m3u'
FONT_FAMILY_TO_USE =
#

FONT_FAMILY_TO_USE

#
'DejaVu Sans Mono'
FONT_SIZE =
#

FONT_SIZE

#
'20'
SMALLER_FONT_SIZE =
#

SMALLER_FONT_SIZE

#
'16'
USE_THIS_FONT =
#

USE_THIS_FONT

#
:hack_23
LARGER_FONT =
#

LARGER_FONT

#
:hack_25
SMALLER_FONT =
#

SMALLER_FONT

#
:hack_20

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

Class Method Summary collapse

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

Methods included from CommandlineArgumentsModule

#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 = nil, run_already = true) ⇒ Radio

#

initialize

#


101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 101

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  determine_the_GUI_to_be_used(commandline_arguments) # This must come first, even before reset().
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  on_delete_event_quit_the_application
  if commandline_arguments and commandline_arguments.respond_to?(:first)
    set_parent(
      commandline_arguments.first
    )
  end
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

MultimediaParadise::GUI::UniversalWidgets::Radio[]

#


1356
1357
1358
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1356

def self.[](i = ARGV)
  new(i)
end

.run(i = ARGV) ⇒ Object

#

MultimediaParadise::GUI::UniversalWidgets::Radio.run

#


1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1319

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::MultimediaParadise::GUI::Gtk::Radio.new(i)
  r = ::Gtk.run
  r << _
  _.set_parent_widget(r) # Must come before we enable the key-combinations.
  
  r.enable_context_menu_on_button_click_events
  r.signal_connect(:delete_event) { |_widget| ::Gtk.main_quit }
  _.maximize_button?.set_new_parent(r)

  # ======================================================================= #
  # Next we will add several alt+key shortcuts.
  # ======================================================================= #
  r.shortcuts {[
    [1, 'click_on_button_number(1)',  :alt],
    [2, 'click_on_button_number(3)',  :alt],
    [3, 'click_on_button_number(5)',  :alt],
    [4, 'click_on_button_number(7)',  :alt],
    [5, 'click_on_button_number(9)',  :alt],
    [6, 'click_on_button_number(11)', :alt],
    [7, 'click_on_button_number(13)', :alt],
    [8, 'click_on_button_number(15)', :alt],
    [9, 'click_on_button_number(17)', :alt]
  ]}
  r.automatic_size_then_automatic_title
  r.enable_quick_exit
  r.set_background :white
  r.maximize
  r.top_left_then_run
end

.title?Boolean

#

MultimediaParadise::GUI::Gtk::Radio.title?

#

Returns:

  • (Boolean)


44
45
46
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 44

def self.title?
  TITLE
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


410
411
412
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 410

def border_size?
  0
end

#button_stop_playback?Boolean

#

button_stop_playback?

#

Returns:

  • (Boolean)


696
697
698
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 696

def button_stop_playback?
  @button_stop_playback
end

#change_directory_on_roebe_systems_unless_in_depot_subdirectory(use_this_directory = '/Depot/j/') ⇒ Object

#

change_directory_on_roebe_systems_unless_in_depot_subdirectory

This is mostly a “safeguard” on my home system, so I don’t spam random .mp3 files all over the filesystem.

#


685
686
687
688
689
690
691
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 685

def change_directory_on_roebe_systems_unless_in_depot_subdirectory(
    use_this_directory = '/Depot/j/'
  )
  if is_on_roebe? and !return_pwd.include?('/Depot/')
    Dir.chdir(use_this_directory) if File.directory? use_this_directory
  end
end

#check_for_the_title_after_a_brief_delay(button = @this_button_is_now_playing, delay_to_use = 2200) ⇒ Object

#

check_for_the_title_after_a_brief_delay

#


1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1171

def check_for_the_title_after_a_brief_delay(
    button       = @this_button_is_now_playing,
    delay_to_use = 2200
  )
  GLib::Timeout.add(delay_to_use) {
    this_radio_station = button.label.to_s.strip
    if this_radio_station =~ /^\d{1,2}$/
      # =================================================================== #
      # In this case we have to change the title. We need to access the 
      # elements 0,2,4,6 and so forth, and disregard the other entries. 
      # So, entry number 1 becomes 0, entry number 2 becomes 2, entry 
      # number 3 becomes 4, entry number 4 becomes 6, and so forth.
      # The formula is thus: 2 * (n-1)
      # =================================================================== #
      this_radio_station = 2 * (this_radio_station.to_i - 1)
      this_radio_station = @array_buttons[this_radio_station].label.to_s
    end
    _ = "Now playing from this radio station: "\
        "#{this_radio_station}".dup
    if MultimediaParadise.title_of_the_audio_file?
      _ << "\nThe title is: #{MultimediaParadise.title_of_the_audio_file?}"
    end
    # ===================================================================== #
    # Finally, propagate our findings to the correct gtk-label in use:
    # ===================================================================== #
    @label_displaying_the_radio_station.set_text(_)
    @label_displaying_the_radio_station.make_bold
    @label_displaying_the_radio_station.make_selectable
    false
  }
end

#click_on_button_number(number = 0) ⇒ Object Also known as: click_on_this_button_by_number

#

click_on_button_number

This method can be used to click on any button programmatically.

#


234
235
236
237
238
239
240
241
242
243
244
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 234

def click_on_button_number(
    number = 0
  )
  # ======================================================================= #
  # We modify the given number. This is necessary because we first add
  # an index-button to the playlist, hence the *2 modifier below.
  # ======================================================================= #
  number = number.to_i
  _ = return_all_buttons_except_for_the_stop_playback_button
  _[number].signal_emit(:clicked)
end

#connect_the_skeletonObject

#

connect_the_skeleton (connect tag)

#


1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1274

def connect_the_skeleton
  abort_on_exception

  outer_vbox = create_vbox

  hbox1_dragger = drag_via_left_and_right_movement_of_the_mouse(
    return_widgets_on_the_left_side,
    return_widget_containing_the_buttons_for_all_streams
  )
  hbox1_dragger.set_border_width(2)
  outer_vbox.minimal(@header_bar)

  top_widget = create_hbox
  top_widget.maximal(hbox1_dragger)
  dragger1 = drag_via_up_and_down_mouse_movement(
    top_widget,
    return_bottom_widget
  )
  dragger1.position = '25%'
  dragger1.set_border_width(4)
  outer_vbox.maximal(dragger1, 2)

  window = create_window_or_runner(nil, width?, height?, title?)
  window << outer_vbox

  properly_prepare_this_window(window,
    {
      title:       title?,
      font:        font?,
      width:       width?,
      height:      height?,
      padding:     padding?,
      border_size: border_size?
    }
  )
  window.set_size_request(width?, height?)
  window.show_all
  window.top_left
  do_all_startup_related_actions
  run_main
end

#create_our_status_icon(i = FILE_RADIO_IMAGE) ⇒ Object

#

create_our_status_icon

#


1018
1019
1020
1021
1022
1023
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1018

def create_our_status_icon(
    i = FILE_RADIO_IMAGE
  )
  @status_icon = create_status_icon(i)
  @status_icon.hint = ' <b>Play</b> from radio station '
end

#create_the_buttonsObject

#

create_the_buttons

#


780
781
782
783
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 780

def create_the_buttons
  create_the_stop_playback_button
  create_the_maximize_button
end

#create_the_entriesObject

#

create_the_entries (entries tag)

#


417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 417

def create_the_entries
  # ======================================================================= #
  # === @entry_stream
  # ======================================================================= #
  @entry_stream = create_entry
  @entry_stream.width_height(920, 44)
  @entry_stream.center
  @entry_stream.set_text(DEFAULT_STREAM)
  @entry_stream.pad2px
  @entry_stream.yellow_background
  @entry_stream.bblack1
  @entry_stream.set_font(smaller_font?)
  @entry_stream.hint = 'Input the main URL here for the radio '\
    'stream in use. Alternatively click on one of the buttons '\
    'above; the current remote URL in use will then be shown '\
    'in the entry above.'
  @entry_stream.on_enter {
    do_all_actions_associated_when_an_actionable_radio_button_was_clicked
  }
  # ======================================================================= #
  # === @entry_status_bar
  # ======================================================================= #
  @entry_status_bar = create_entry
  @entry_status_bar.on_click_event { :select_everything }
  @entry_status_bar.make_bold
  @entry_status_bar.center
  @entry_status_bar.bblack1
  @entry_status_bar.pad8px
  @entry_status_bar.css_class('BG_lightblue')
  @entry_status_bar.width_height(250, 20)
  @entry_status_bar.hint =
    'This entry will show the URL to the remote stream, if one is playing '\
    'currently, so that the user can quickly copy/paste this URL.'
end

#create_the_header_barObject Also known as: create_the_top_bar

#

create_the_header_bar (top tag)

#


1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1239

def create_the_header_bar
  # ======================================================================= #
  # === @header_bar
  # ======================================================================= #
  @header_bar = default_header
  # @header_bar.main_text = 'Radio'
  @header_bar.add_left(
    return_the_menu_bar
  )
  @header_bar.add_right(
    return_the_quit_button
  )
  @header_bar.add_right(
    return_the_mini_clock
  )
  @header_bar.add_right(
    return_the_maximize_button
  )
  @header_bar.add_right(
    return_the_widget_for_muting_and_unmuting_the_audio
  )
  @header_bar.pad5px
  @header_bar.spacing = 10
end

#create_the_labelsObject

#

create_the_labels

#


1038
1039
1040
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1038

def create_the_labels
  @label_displaying_the_radio_station = text
end

#create_the_maximize_buttonObject

#

create_the_maximize_button

#


797
798
799
800
801
802
803
804
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 797

def create_the_maximize_button
  # ======================================================================= #
  # === @maximize_button
  # ======================================================================= #
  @maximize_button = ::Gtk::MaximizeButton.new(main_window?)
  @maximize_button.can_focus = false
  @maximize_button.no_relief
end

#create_the_menuObject

#

create_the_menu (menu tag)

This is the toplevel menubar, captured onto @menu_bar.

#


593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 593

def create_the_menu
  # ======================================================================= #
  # === @menu_bar
  # ======================================================================= #
  @menu_bar = create_menu_bar
  filemenu1 = create_menu
  # ======================================================================= #
  # === 1) First menu drop-down interface
  # ======================================================================= #
  filem1 = create_menu_item('File') {{ submenu: filemenu1 }}
  # ======================================================================= #
  # === Add the 'Reset the Widget' entry next:
  # ======================================================================= #
  reset_the_widget = create_menu_item('Reset the widget')
  reset_the_widget.fancy_tooltips = '<b>Clicking</b> on this item will '\
    '<b>reset</b> the main widget to its initial state, as if you would '\
    'have just started this application.'
  reset_the_widget.on_activate {
    do_reset_the_widget
  }
  filemenu1 << reset_the_widget
  filemenu1.append_separator
  # ======================================================================= #
  # === Add the 'Exit' entry next:
  # ======================================================================= #
  exit = create_menu_item('Exit') { :on_activate_quit }
  filemenu1 << exit
  # ======================================================================= #
  # === (2) Second menu drop-down interface
  # ======================================================================= #
  filemenu2 = create_menu
  filem2 = create_menu_item('Capture the stream') {{ submenu: filemenu2 }}
  # ======================================================================= #
  # === Add the 'Shall the stream be captured' entry next:
  # ======================================================================= #
  capture_the_stream_yes = ::Gtk::RadioMenuItem.new(nil, 'Yes')
  capture_the_stream_yes.on_activate { @capture_the_stream = true }
  capture_the_stream_no  = ::Gtk::RadioMenuItem.new(capture_the_stream_yes, 'No')
  capture_the_stream_no.on_activate  { @capture_the_stream = false }
  if is_on_roebe?
    capture_the_stream_no.activate
  end
  filemenu2 << capture_the_stream_yes
  filemenu2 << capture_the_stream_no
  # ======================================================================= #
  # === (3) The info widget
  # ======================================================================= #
  filemenu3 = create_menu
  filem3 = create_menu_item('Info') {{ submenu: filemenu3 }}
  # ======================================================================= #
  # === Add the 'Show all URLs' entry next:
  # ======================================================================= #
  show_all_URLs = create_menu_item('Show all URLs to the radio station')
  show_all_URLs.on_activate {
    do_show_all_URLs
  }
  filemenu3 << show_all_URLs
  # ======================================================================= #
  # === Add the 'Show more info about this widget' entry next:
  # ======================================================================= #
  show_more_info = create_menu_item('Show more info about this widget')
  show_more_info.on_activate { do_show_more_info_about_this_widget }
  filemenu3 << show_more_info
  # ======================================================================= #
  # === Add the 'Debug' widget next:
  # ======================================================================= #
  debug_this_widget = create_menu_item('Debug this widget')
  debug_this_widget.on_activate { do_debug_this_widget }
  filemenu3 << debug_this_widget
  # ======================================================================= #
  # Next, add the file-menu parts to the menu bar.
  # ======================================================================= #
  @menu_bar.add_these(
    filem1, gtk_separator_menu_item,
    filem2, gtk_separator_menu_item,
    filem3, gtk_separator_menu_item
  )
end

#create_the_skeletonObject

#

create_the_skeleton (create tag, skeleton tag)

#


1005
1006
1007
1008
1009
1010
1011
1012
1013
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1005

def create_the_skeleton
  create_the_statusbar   # (1)
  create_the_buttons     # (2) Must come before we create the header-bar.
  create_the_entries     # (3)
  create_the_labels      # (4)
  create_the_menu        # (5) Must come before we create the header-bar.
  create_the_header_bar  # (6) Must come after create_the_menu().
  create_our_status_icon # (7)
end

#create_the_statusbarObject

#

create_the_statusbar

#


480
481
482
483
484
485
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 480

def create_the_statusbar
  # ======================================================================= #
  # === @status_bar
  # ======================================================================= #
  @status_bar = status_bar
end

#create_the_stop_playback_buttonObject

#

create_the_stop_playback_button (stop tag)

The “stop playback” button is situated closer towards the bottom of the main widget, right above the two buttons that can be used to modify the audio volume on a linux system.

#


334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 334

def create_the_stop_playback_button
  # ======================================================================= #
  # Create the "stop playback" button next.
  # ======================================================================= #
  @button_stop_playback = bold_button('Stop playback')
  @button_stop_playback.bblack2
  @button_stop_playback.grey_out
  @button_stop_playback.background_colour = :lightblue
  @button_stop_playback.on_hover(:paleturquoise)
  # ======================================================================= #
  # Add a tooltip next.
  # ======================================================================= #
  @button_stop_playback.hint =
    "Click this button to stop the current song that is "\
    "played (if a song is currently playing that is).\n\n"\
    "If no radio-station is used then the button is "\
    "not functional yet.\n\n"\
    "Otherwise, clicking on the button will also re-enable "\
    "clicking on the actionable play-from-a-stream buttons."
  @button_stop_playback.on_clicked {
    do_all_the_actions_associated_when_the_button_stop_playback_was_clicked
  }
end

#do_all_actions_associated_when_an_actionable_radio_button_was_clicked(use_this_remote_URL = @entry_stream.text?, capture_into_this_file = :pwd_or_user_supplied_value, button = nil) ⇒ Object

#

do_all_actions_associated_when_an_actionable_radio_button_was_clicked (clicked tag)

This method bundles together all actions associated with the main button-click event. It will play the remote URL stream upon a button-click event.

#


1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1049

def do_all_actions_associated_when_an_actionable_radio_button_was_clicked(
    use_this_remote_URL    = @entry_stream.text?,
    capture_into_this_file = :pwd_or_user_supplied_value,
    button                 = nil
  )
  do_all_the_actions_associated_when_the_button_stop_playback_was_clicked
  case capture_into_this_file
  # ======================================================================= #
  # === :pwd_or_user_supplied_value
  # ======================================================================= #
  when :pwd_or_user_supplied_value,
       :default,
       :default_capture_stream
    capture_into_this_file = return_capture_into_the_default_file
    _ = save_the_stream_into_which_file?
    if _ and !_.empty?
      capture_into_this_file = _.dup
    end
  # ======================================================================= #
  # === :pwd
  # ======================================================================= #
  when :pwd
    capture_into_this_file = return_capture_into_the_default_file
  end
  # ======================================================================= #
  # Next, make the stop-playback button clickable again.
  # ======================================================================= #
  make_the_stop_playback_button_clickable_again
  e
  e
  e "#{rev}#{tomato('The remote URL is:')}"
  e
  e steelblue("  #{use_this_remote_URL}")
  e
  # ======================================================================= #
  # The next line of code changes the gtk-entry where the user stores
  # the .mp3 file, but since as of 30.09.2020 the user is able to
  # control it. Only if it is empty will a sane default value be
  # used.
  # ======================================================================= #
  if @entry_save_into_this_file.empty?
    @entry_save_into_this_file.set_text(capture_into_this_file)
  end
  check_for_the_title_after_a_brief_delay(button) if button
  set_url_to_use(use_this_remote_URL)
  set_status_bar_message(use_this_remote_URL)
  if button
    this_button_is_now_playing(button)
    _ = "Radio station: #{button.label}".dup
    if MultimediaParadise.title_of_the_audio_file? and
      !MultimediaParadise.title_of_the_audio_file?.empty?
      _ << "\nTitle is: #{MultimediaParadise.title_of_the_audio_file?}"
    end
    @label_displaying_the_radio_station.set_text(_)
    @label_displaying_the_radio_station.make_bold
    @label_displaying_the_radio_station.center
  end
  do_play_from_this_stream(use_this_remote_URL, capture_into_this_file)
  # The next line was disabled as of May 2022:
  # do_grey_out_all_buttons_except_for_the_stop_playback_button
end
#
#


490
491
492
493
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 490

def do_all_startup_related_actions
  change_directory_on_roebe_systems_unless_in_depot_subdirectory
  run_in_the_background if shall_we_run_in_the_background?
end

#do_all_the_actions_associated_when_the_button_stop_playback_was_clickedObject

#

do_all_the_actions_associated_when_the_button_stop_playback_was_clicked

This method bundles together the actions that are associated with the user clicking on the “stop playback” button.

#


1229
1230
1231
1232
1233
1234
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1229

def do_all_the_actions_associated_when_the_button_stop_playback_was_clicked
  do_stop_playing_the_current_song
  @button_stop_playback.grey_out # Reset it again.
  @label_displaying_the_radio_station.set_text ''
  set_status_bar_message(:clear)
end

#do_debug_this_widgetObject

#

do_debug_this_widget

#


728
729
730
731
732
733
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 728

def do_debug_this_widget
  e 'Currently this functionality is not implemented '\
    '(January 2021) - somehow class Gtk::DebugWidget'
  e 'has to be improved be found ...'
  # ::Gtk::DebugWidget.new
end

#do_grey_out_all_buttons_except_for_the_stop_playback_buttonObject Also known as: disable_all_main_buttons

#

do_grey_out_all_buttons_except_for_the_stop_playback_button

This method used to be called when a new button has been clicked for playing a radio-stream. It was disabled as of May 2022, though, as it is better to NOT grey out the buttons.

#


1125
1126
1127
1128
1129
1130
1131
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1125

def do_grey_out_all_buttons_except_for_the_stop_playback_button
  these_buttons_are_to_be_greyed_out = 
    return_all_buttons_except_for_the_stop_playback_button
  these_buttons_are_to_be_greyed_out.each {|button|
    button.grey_out
  }
end

#do_kill_the_mpv_process(use_this_pid = @pid) ⇒ Object Also known as: do_stop_playing_the_current_song, kill_this_process, kill_this_pid

#

do_kill_the_mpv_process

This method will simply kill the passed PID - use with care.

#


251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 251

def do_kill_the_mpv_process(
    use_this_pid = @pid
  )
  if use_this_pid
    if is_on_roebe?
      e "#{rev}Now killing the pid: "\
        "#{::Colours.steelblue(use_this_pid.to_s)}\n\n"
    end
    begin
      case use_this_pid
      when Process.pid # Protect against self-killing here.
        e 'Can not kill the PID of this process.'
      else
        Process.kill('HUP', use_this_pid)
      end
    rescue Exception => error
      if is_on_roebe?
        e 'An error happened in Process.kill() '\
          'at line '+__LINE__.to_s+', in the method '+__method__.to_s
      end
      pp error
    end
  end
end

#do_mute_the_audioObject

#

do_mute_the_audio

Use ALSA to mute the audio.

#


363
364
365
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 363

def do_mute_the_audio
  system 'amixer set Master mute'
end

#do_play_from_this_stream(i = @entry_stream.text?, capture_into_this_file = nil) ⇒ Object

#

do_play_from_this_stream

#


290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 290

def do_play_from_this_stream(
    i                      = @entry_stream.text?,
    capture_into_this_file = nil
  )
  # ======================================================================= #
  # Build up the command we wish to use next.
  # ======================================================================= #
  use_this_command = "mpv #{i}".dup
  if capture_into_this_file
    use_this_command << ' --stream-record="'+capture_into_this_file+'"'
  end
  e steelblue(use_this_command)
  # @pid = spawn(use_this_command)
  io_object = IO.popen(use_this_command, 'r+')
  @pid = io_object.pid
  if is_on_roebe?
    e "The PID is: #{steelblue(@pid)}"
  end
  Thread.new {
    # Process.wait(@pid)
    io_object.each { |line|
      if line.start_with? ' icy-title: '
        ::MultimediaParadise.register_title_of_this_audio_file(line)
      end
      e line
    }
    io_object.close
  }
end

#do_show_all_URLs(radio_stations = radio_stations? ) ⇒ Object

#

do_show_all_URLs

#


962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 962

def do_show_all_URLs(
    radio_stations = radio_stations?
  )
  # ======================================================================= #
  # First, create a widget.
  # ======================================================================= #
  vbox = create_vbox
  vbox.set_border_width(20)
  # ======================================================================= #
  # Second, show them on the commandline.
  # ======================================================================= #
  radio_stations.values.map {|hash| hash['url'] }.each {|remote_URL|
    e remote_URL
    text = left_aligned_text(
      '<a href="remote_URL">'+remote_URL+'</a>'
    )
    text.do_markify
    vbox.minimal(
      text, 2
    )
  }
  scrolled_window = scrolled_window(vbox) { :always }
  scrolled_window.set_border_width(20)
  scrolled_window.width_height(800, 900)
  scrolled_window.bblack2
  return_popover(
    'Remote URLs.',
    header_bar?,
    5,
    scrolled_window
  ).popup
end

#do_show_more_info_about_this_widgetObject

#

do_show_more_info_about_this_widget

#


745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 745

def do_show_more_info_about_this_widget
  about_dialog = create_about_dialog
  author = ['Robert A. Heiler']
  about_dialog.artists = author
  about_dialog.authors = author
  about_dialog.comments =
    "\nThis widget can be used to listen to radio streams. \n\n"\
    "The mpv player will be used for this functionality. The "\
    "radio stations are kept in the .yml file, at "\
    "radio_stations.yml."
  about_dialog.copyright = 'Copyright (C) 2021+ Robert A. Heiler'
  about_dialog.documenters = ['Robert A. Heiler']
  about_dialog.license = 'Please see the homepage on rubygems '\
    'for the licence of this gem called multimedia_paradise.'
  about_dialog.name = 'Gtk::Radio'
  about_dialog.program_name = 'gtk-radio'
  about_dialog.translator_credits = "Robert A. Heiler\n"
  about_dialog.version = "Version: #{::MultimediaParadise::VERSION}"
  about_dialog.website = HOMEPAGE_OF_THIS_PROJECT
  about_dialog.website_label = 'MultimediaParadise Homepage'
  about_dialog. = pixbuf_from_file(::MultimediaParadise::FILE_RADIO_IMAGE)
  about_dialog.run
  # about_dialog.destroy
end

#do_unmute_the_audioObject

#

do_unmute_the_audio

#


370
371
372
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 370

def do_unmute_the_audio
  system 'amixer set Master unmute'
end

#handle_CSS_rulesObject

#

handle_CSS_rules (CSS tag)

#


192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 192

def handle_CSS_rules
  use_gtk_paradise_project_css_file
  append_project_css_file
  more_CSS_then_apply_it '

button #default {
background-image: none;
color: blue;
background-color: yellow;
}

button:hover {
transition: 1000ms linear;
background-color: darkblue;
}

'
end

#header_bar?Boolean

#

header_bar?

#

Returns:

  • (Boolean)


998
999
1000
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 998

def header_bar?
  @header_bar
end

#main_window?Boolean

#

main_window?

This method must yield the parent Gtk::Window.

#

Returns:

  • (Boolean)


790
791
792
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 790

def main_window?
  @parent
end

#make_the_stop_playback_button_clickable_againObject

#

make_the_stop_playback_button_clickable_again

#


225
226
227
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 225

def make_the_stop_playback_button_clickable_again
  @button_stop_playback.grey_in
end

#maximize_button?Boolean

#

maximize_button?

#

Returns:

  • (Boolean)


738
739
740
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 738

def maximize_button?
  @maximize_button
end

#open_this_url_via_the_browser(url) ⇒ Object

#

open_this_url_via_the_browser

#


1206
1207
1208
1209
1210
1211
1212
1213
1214
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1206

def open_this_url_via_the_browser(url)
  unless Object.const_defined? :Open
    begin
      require 'open'
    rescue LoadError; end
  end
  e steelblue(url)
  Open.in_browser(url)
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


403
404
405
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 403

def padding?
  0
end

#radio_stations?Boolean

#

radio_stations?

#

Returns:

  • (Boolean)


584
585
586
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 584

def radio_stations?
  MultimediaParadise.radio_stations?
end

#remote_radio_stations?Boolean

#

remote_radio_stations?

#

Returns:

  • (Boolean)


809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 809

def remote_radio_stations?
  dataset = YAML.load_file(
    MultimediaParadise.file_radio_stations
  )
  # ======================================================================= #
  # The entries will look like this:
  #
  #   "Radio Wien"=>
  #
  #   {"url"=>"http://mp3stream2.apasf.apa.at:8000/listen.pls",
  #    "homepage"=>"https://wien.orf.at/player",
  #    "genre"=>"austrian",
  #    "country"=>"Austria"},
  #
  # ======================================================================= #
  return dataset
end

#resetObject

#

reset (reset tag)

#


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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 122

def reset
  super() if respond_to?(:super)
  reset_the_shared_module # This can come early.
  reset_the_base_module
  reset_the_internal_variables
  infer_the_namespace
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, namespace?]
  # ======================================================================= #
  # === Set the title, width, height and the font in use.
  # ======================================================================= #
  title_width_height_font(
    TITLE, WIDTH, HEIGHT, "#{FONT_FAMILY_TO_USE} #{FONT_SIZE}"
  )
  if use_gtk3?
    handle_CSS_rules
  end
  infer_the_size_automatically
  # ======================================================================= #
  # === @use_this_colour_for_the_tooltip_url
  #
  # Denote the colour for the tooltip URL.
  # ======================================================================= #
  @use_this_colour_for_the_tooltip_url = :steelblue
  # ======================================================================= #
  # === @this_button_is_now_playing
  # ======================================================================= #
  @this_button_is_now_playing = nil
  # ======================================================================= #
  # === @capture_the_stream
  #
  # By default we will NOT capture the audio stream. On roebe-systems
  # we will, though.
  # ======================================================================= #
  if ::MultimediaParadise.is_on_roebe?
    @capture_the_stream = true
  else # else for other users, this is the default
    @capture_the_stream = false
  end
  # ======================================================================= #
  # === @pid
  #
  # The PID will be stored in this variable.
  # ======================================================================= #
  @pid = nil
  # ======================================================================= #
  # === @use_this_player_for_capturing_the_audio_stream
  #
  # This variable specifies which audio-player is used for capturing
  # the remote stream.
  # ======================================================================= #
  @use_this_player_for_capturing_the_audio_stream = :mpv # :mplayer
  # ======================================================================= #
  # === @shall_we_run_in_the_background
  # ======================================================================= #
  @shall_we_run_in_the_background = true
end

#reset_all_gtk_labelsObject

#

reset_all_gtk_labels

#


1114
1115
1116
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1114

def reset_all_gtk_labels
  @label_displaying_the_radio_station.clear
end

#reset_the_shared_moduleObject

#

reset_the_shared_module

This method can be used for ruby-gtk3 and ruby-libui, among other toolkits.

#


284
285
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 284

def reset_the_shared_module
end

#return_all_buttons_except_for_the_stop_playback_buttonObject

#

return_all_buttons_except_for_the_stop_playback_button

#


1219
1220
1221
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1219

def return_all_buttons_except_for_the_stop_playback_button
  return_all_buttons.reject {|button| button == button_stop_playback? }
end

#return_bottom_widgetObject

#

return_bottom_widget (bottom tag)

The bottom widget will, among other widgets, contain these:

- text to show where the stream will be saved into, locally
- entry to allow the user to change where the stream will be stored
- text to show the main entry for the streams
- entry to allow the designation of the streams
#


536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 536

def return_bottom_widget
  grid1 = default_grid
  grid1.spacing = 12
  grid1.pad5px
  grid1.set_column_spacing(4)
  grid1.set_row_spacing(4)
  grid1.reset_the_counter
  grid1.full_row(gtk_horizontal_spacer)
  grid1.left(return_the_label_where_the_stream_is_saved_locally)
  grid1.right(return_the_entry_where_the_stream_is_saved_locally)
  grid1.left(return_the_label_containing_the_main_entry_for_the_streams)
  grid1.right(return_the_main_entry_for_the_streams)
  grid1.full_row(@status_bar)
  grid1.hcenter
  return grid1
end

#return_capture_into_the_default_file(use_this_directory_as_the_base_directory = return_pwd) ⇒ Object

#

return_capture_into_the_default_file

This method has one side-effect: we will cd into the base directory.

#


379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 379

def return_capture_into_the_default_file(
    use_this_directory_as_the_base_directory = return_pwd
  )
  if is_on_roebe?
    change_directory_on_roebe_systems_unless_in_depot_subdirectory
    use_this_directory_as_the_base_directory = return_pwd
  end
  return use_this_directory_as_the_base_directory.squeeze('/')+
         'captured_stream_'+
         Time.now.strftime('%d.%m.%Y')+
         '.mp3'
end

#return_middle_partObject Also known as: return_widget_containing_the_buttons_for_all_streams

#

return_middle_part

This method will obtain and create the various radio-stations and assign a customized, clickable button to each such radio station.

#


833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 833

def return_middle_part
  vbox = create_vbox
  index = 0
  # ======================================================================= #
  # Next, obtain all available radio stations, then add a button for
  # each of these stations.
  #
  # The data structure may look like this:
  #
  #   ["ORF Radio Wien", {"url"=>"http://185.85.29.149:8000/", "genre"=>"austrian"}]
  #
  # ======================================================================= #
  remote_radio_stations?.each_pair {|this_radio_station, inner_hash| index += 1
    outer_mini_hbox = create_hbox
    url, _homepage, genre, country = inner_hash.values_at('url','homepage','genre','country')
    padded_index = index.to_s.rjust(3, ' ')
    # ===================================================================== #
    # Next, the radio-image is added to the very left hand side. This
    # is actually an event-box that the user can click. It will then
    # open the remote URL to the homepage of this radio-station.
    # ===================================================================== #
    radio_image = create_image(::MultimediaParadise::FILE_RADIO_IMAGE)
    event_box = create_event_box(radio_image)
    # ===================================================================== #
    # Use a tooltip:
    # ===================================================================== #
    event_box.hint =
      'Click on this to open the remote URL '\
      '<span weight="bold" foreground="gold">'+url+'</span>.'
    event_box.signal_connect(:event) { |widget, event|
      _ = event.event_type.name
      case _
      when 'GDK_BUTTON_PRESS'
        open_this_url_via_the_browser(url)
      end
    }
    outer_mini_hbox.minimal(event_box)

    index_button = create_button(padded_index)
    index_button.make_bold
    index_button.on_hover(:limegreen)
    # ===================================================================== #
    # === Small index button
    #
    # We also use a small index-button. The main idea here is to keep
    # a small number for the radio station, so the user knows which
    # entry is used.
    # ===================================================================== #
    index_button.on_clicked {
      do_all_actions_associated_when_an_actionable_radio_button_was_clicked(
        url, :default_capture_stream, index_button
      )
    }
    outer_mini_hbox.minimal(index_button) # Add the index_button here.

    button = bold_button(this_radio_station)
    button.remove_background
    button.on_hover(:lightgreen)
    # ===================================================================== #
    # Next, add code so that the button for the radio-station can play 
    # from the remote audio stream.
    # ===================================================================== #
    button.on_clicked {
      do_all_actions_associated_when_an_actionable_radio_button_was_clicked(
        url, :default, button
      )
    }
    # ======================================================================= #
    # Add a tooltip next. This will have bold markup, in colour.
    # ======================================================================= #
    button.tooltip_markup = ""\
      "<span weight=\"bold\">#{padded_index}</span> "\
      "#{this_radio_station}\n\n  → "\
      "<span weight=\"bold\" foreground=\"#{@use_this_colour_for_the_tooltip_url}\">#{url}</span>"\
      "\n"
    # button.css_class('small_button')
    outer_mini_hbox.maximal(button)
    # ===================================================================== #
    # Next we need to handle radio stations from different countries
    # a bit differently. Also, we allow for genre-entries without a
    # country tag to be handled here.
    # ===================================================================== #
    case genre
    when 'Trance'
      country = 'Trance'
    end
    case country
    when 'Austria',
         'Germany',
         'UK',
         'France',
         'USA',
         'Trance' # This is not a country - see explanation above.
      # =================================================================== #
      # In this event show a cute little "banner" image.
      # =================================================================== #
      # =================================================================== #
      # Pack the small austrian flag into that hbox:
      # =================================================================== #
      case country
      when 'Trance'
        flag_image = create_image(::MultimediaParadise.project_base_dir?+'images/trance.png')
      when 'USA'
        flag_image = create_image(::MultimediaParadise.project_base_dir?+'images/US_flag.png')
      when 'France'
        flag_image = create_image(::MultimediaParadise.project_base_dir?+'images/french_flag.png')
      when 'UK'
        flag_image = create_image(::MultimediaParadise.project_base_dir?+'images/UK_flag.png')
      when 'Austria'
        flag_image = create_image(::MultimediaParadise.project_base_dir?+'images/austrian_flag.png')
      when 'Germany'
        flag_image = create_image(::MultimediaParadise.project_base_dir?+'images/german_flag.png')
      end
      frame = create_frame(flag_image)
      frame.modify_background :default, :lightgrey
      outer_mini_hbox.minimal(frame, 0)
    end
    vbox.maximal(outer_mini_hbox, 1)
  }
  _ = scrolled_window(vbox)# { :up_and_down }
  _.width_height(500, 500)
  _.bblack2
  _.set_name('scrollbar3') # The name is #scrollbar3.
  return _
end

#return_the_entry_where_the_stream_is_saved_locallyObject

#

return_the_entry_where_the_stream_is_saved_locally

#


455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 455

def return_the_entry_where_the_stream_is_saved_locally
  @entry_save_into_this_file = create_entry
  if ::Gtk.is_on_roebe?
    @entry_save_into_this_file.set_text(
      return_capture_into_the_default_file
    )
  end
  @entry_save_into_this_file.yellow_background
  @entry_save_into_this_file.pad2px
  @entry_save_into_this_file.bblack1
  @entry_save_into_this_file.center
  @entry_save_into_this_file.set_font(smaller_font?)
  return @entry_save_into_this_file
end

#return_the_increase_and_decrease_the_volume_widget_as_well_as_the_stop_playback_buttonObject

#

return_the_increase_and_decrease_the_volume_widget_as_well_as_the_stop_playback_button

#


514
515
516
517
518
519
520
521
522
523
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 514

def return_the_increase_and_decrease_the_volume_widget_as_well_as_the_stop_playback_button
  outer_vbox = create_vbox
  increase_decrease_volume_widget = hbox(increase_decrease_volume)
  increase_decrease_volume_widget.make_bold
  outer_vbox.minimal(hbox(button_stop_playback?).hcenter)
  outer_vbox.minimal(create_hsep)
  outer_vbox.minimal(increase_decrease_volume_widget)
  outer_vbox.hcenter
  return outer_vbox
end

#return_the_label_containing_the_main_entry_for_the_streamsObject

#

return_the_label_containing_the_main_entry_for_the_streams

#


573
574
575
576
577
578
579
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 573

def return_the_label_containing_the_main_entry_for_the_streams
  _ = text('Use this stream:', 8)
  _.left_align
  _.set_font(smaller_font?)
  _.make_bold
  return _
end

#return_the_label_where_the_stream_is_saved_locallyObject

#

return_the_label_where_the_stream_is_saved_locally

#


556
557
558
559
560
561
562
563
564
565
566
567
568
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 556

def return_the_label_where_the_stream_is_saved_locally
  @label_save_the_stream_into_this_file = label(
    'Save the stream into this file:'
  )
  @label_save_the_stream_into_this_file.hint = 
    'This will denote <b>into</b> which file the stream is to be '\
    'stored, e. g. <b>a local path</b> for a <b>.mp3 file</b>. '\
    'Take note that this will <b>overwrite</b> the old file, '\
    'should such a file exist.'
  @label_save_the_stream_into_this_file.set_font(smaller_font?)
  @label_save_the_stream_into_this_file.make_bold
  return @label_save_the_stream_into_this_file
end

#return_the_main_entry_for_the_streamsObject

#

return_the_main_entry_for_the_streams

#


473
474
475
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 473

def return_the_main_entry_for_the_streams
  return @entry_stream
end

#return_the_maximize_buttonObject

#

return_the_maximize_button

#


703
704
705
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 703

def return_the_maximize_button
  return @maximize_button
end

#return_the_menu_barObject

#

return_the_menu_bar

#


675
676
677
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 675

def return_the_menu_bar
  return @menu_bar
end

#return_the_mini_clockObject

#

return_the_mini_clock

#


1028
1029
1030
1031
1032
1033
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1028

def return_the_mini_clock
  return ::Gtk::MiniClock.widget {{
    make_bold:        true,
    use_this_colour: :indigo # olive
  }}
end

#return_the_quit_buttonObject

#

return_the_quit_button

#


1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1136

def return_the_quit_button
  the_quit_button = image_application_exit
  the_quit_button.hint = 'This button will exit the application.'
  the_quit_button.can_focus = false
  event_box_for_the_quit_button = create_event_box(the_quit_button)
  event_box_for_the_quit_button.on_clicked {
    exit_the_application
  }
  return event_box_for_the_quit_button
end

#return_the_widget_for_muting_and_unmuting_the_audioObject

#

return_the_widget_for_muting_and_unmuting_the_audio

#


710
711
712
713
714
715
716
717
718
719
720
721
722
723
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 710

def return_the_widget_for_muting_and_unmuting_the_audio
  button_mute = check_button('Mute')
  button_mute.hint = 'Click on this button to mute/unmute the audio.'
  button_mute.label_widget.darkblue
  button_mute.label_widget.make_bold
  button_mute.on_clicked {
    if button_mute.active?
      do_mute_the_audio
    else
      do_unmute_the_audio
    end
  }
  return button_mute
end

#return_the_widget_increase_or_decrease_audioObject Also known as: increase_decrease_volume

#

return_the_widget_increase_or_decrease_audio

#


323
324
325
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 323

def return_the_widget_increase_or_decrease_audio
  ::MultimediaParadise::GUI::Gtk::WidgetIncreaseOrDecreaseAudio.new
end

#return_widgets_on_the_left_sideObject

#

return_widgets_on_the_left_side (left tag)

This will also hold the increase-and-decrease widget.

#


500
501
502
503
504
505
506
507
508
509
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 500

def return_widgets_on_the_left_side
  vbox_on_the_left_side = create_vbox
  vbox_on_the_left_side.same_minimal(
    1,
    return_the_increase_and_decrease_the_volume_widget_as_well_as_the_stop_playback_button,
    @label_displaying_the_radio_station,
    @entry_status_bar
  )
  return vbox_on_the_left_side
end

#runObject

#

run (run tag)

#


1267
1268
1269
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1267

def run
  run_super
end

#save_the_stream_into_which_file?Boolean

#

save_the_stream_into_which_file?

#

Returns:

  • (Boolean)


1164
1165
1166
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1164

def save_the_stream_into_which_file?
  @entry_save_into_this_file.text?
end

#set_parent(i) ⇒ Object

#

set_parent

#


395
396
397
398
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 395

def set_parent(i)
  i = first if i.is_a? Array
  @parent = i
end

#set_status_bar_message(i = '') ⇒ Object

#

set_status_bar_message

#


214
215
216
217
218
219
220
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 214

def set_status_bar_message(i = '')
  case i
  when :clear
    i = ''
  end
  @entry_status_bar.set_text(i)
end

#set_url_to_use(i) ⇒ Object

#

set_url_to_use

#


1157
1158
1159
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1157

def set_url_to_use(i)
  @entry_stream.set_text(i.to_s)
end

#shall_we_run_in_the_background?Boolean

#

shall_we_run_in_the_background?

#

Returns:

  • (Boolean)


185
186
187
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 185

def shall_we_run_in_the_background?
  @shall_we_run_in_the_background
end

#smaller_font?Boolean

#

smaller_font?

#

Returns:

  • (Boolean)


773
774
775
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 773

def smaller_font?
  "#{FONT_FAMILY_TO_USE} #{SMALLER_FONT_SIZE}"
end

#this_button_is_now_playing(button) ⇒ Object

#

this_button_is_now_playing

#


1150
1151
1152
# File 'lib/multimedia_paradise/gui/universal_widgets/radio/radio.rb', line 1150

def this_button_is_now_playing(button)
  @this_button_is_now_playing = button
end