diff options
-rwxr-xr-x | bin/gtk-fair-viewer | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/bin/gtk-fair-viewer b/bin/gtk-fair-viewer index 25e4749..b79b547 100755 --- a/bin/gtk-fair-viewer +++ b/bin/gtk-fair-viewer @@ -16,7 +16,7 @@ #------------------------------------------------------- # GTK Fair Viewer # Fork: 14 February 2020 -# Edit: 05 October 2020 +# Edit: 15 October 2020 # https://framagit.org/heckyel/fair-viewer #------------------------------------------------------- @@ -1337,6 +1337,23 @@ sub menu_popup { $menu->append($item); } + # Play as audio + { + my $item = 'Gtk3::ImageMenuItem'->new("Play as audio"); + $item->signal_connect( + activate => sub { + my ($video_id, $iter) = get_selected_entry_code(); + if (defined($video_id) and $liststore->get($iter, 7) eq 'video') { + execute_cli_fair_viewer("--id=$video_id --no-video"); + } + } + ); + $item->set_property(tooltip_text => "Play as audio in a new terminal"); + $item->set_image('Gtk3::Image'->new_from_icon_name("multimedia-audio-player", q{menu})); + $item->show; + $menu->append($item); + } + # Play with CLI fair-viewer { my $item = 'Gtk3::ImageMenuItem'->new("Play in terminal"); @@ -3119,13 +3136,12 @@ sub run_cli_fair_viewer { sub get_options_as_arguments { my @args; my %options = ( - 'no-interactive' => q{}, - 'resolution' => $CONFIG{resolution}, - 'download-dir' => quotemeta(rel2abs($CONFIG{downloads_dir})), - 'fullscreen' => $CONFIG{fullscreen} ? q{} : undef, - 'no-dash' => $CONFIG{dash_support} ? undef : q{}, - 'no-video' => $CONFIG{audio_only} ? q{} : undef, - 'resolution=audio' => $CONFIG{audio_only} ? q{} : undef, + 'no-interactive' => q{}, + 'resolution' => $CONFIG{resolution}, + 'download-dir' => quotemeta(rel2abs($CONFIG{downloads_dir})), + 'fullscreen' => $CONFIG{fullscreen} ? q{} : undef, + 'no-dash' => $CONFIG{dash_support} ? undef : q{}, + 'no-video' => $CONFIG{audio_only} ? q{} : undef, ); while (my ($argv, $value) = each %options) { |