Skip to content

Commit

Permalink
- CLI: added basic support for Android, playing videos with the VLC p…
Browse files Browse the repository at this point in the history
…layer.

- Version bump to 3.10.6.
  • Loading branch information
trizen committed Feb 8, 2023
1 parent f0a57b4 commit 89cd450
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 26 deletions.
4 changes: 2 additions & 2 deletions bin/gtk-youtube-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#-------------------------------------------------------
# GTK YouTube Viewer
# Created on: 12 September 2010
# Latest edit on: 06 January 2023
# Latest edit on: 08 February 2023
# https://github.com/trizen/youtube-viewer
#-------------------------------------------------------

Expand All @@ -28,7 +28,7 @@ no warnings 'once';
my $DEVEL; # true in devel mode
use if ($DEVEL = -w __FILE__), lib => qw(../lib); # devel only

use WWW::YoutubeViewer v3.10.5;
use WWW::YoutubeViewer v3.10.6;
use WWW::YoutubeViewer::RegularExpressions;

use Gtk3 qw(-init);
Expand Down
66 changes: 43 additions & 23 deletions bin/youtube-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#-------------------------------------------------------
# youtube-viewer
# Created on: 02 June 2010
# Latest edit on: 06 January 2023
# Latest edit on: 08 February 2023
# https://github.com/trizen/youtube-viewer
#-------------------------------------------------------

Expand Down Expand Up @@ -62,7 +62,7 @@ no warnings 'once';
my $DEVEL; # true in devel mode
use if ($DEVEL = -w __FILE__), lib => qw(../lib); # devel mode

use WWW::YoutubeViewer v3.10.5;
use WWW::YoutubeViewer v3.10.6;
use WWW::YoutubeViewer::RegularExpressions;

use File::Spec::Functions qw(
Expand Down Expand Up @@ -94,7 +94,10 @@ my $term_width = 80;
my %WATCHED_VIDEOS;

# Unchangeable data goes here
my %constant = (win32 => ($^O eq 'MSWin32' ? 1 : 0)); # doh
my %constant = (
win32 => (lc($^O) eq 'mswin32' ? 1 : 0),
android => (lc($^O) eq 'android' ? 1 : 0),
);

my $home_dir;
my $xdg_config_home = $ENV{XDG_CONFIG_HOME};
Expand Down Expand Up @@ -172,33 +175,50 @@ sub which_command {
my %CONFIG = (

video_players => {
vlc => {
cmd => q{vlc},
srt => q{--sub-file=*SUB*},
audio => q{--input-slave=*AUDIO*},
fs => q{--fullscreen},
arg => q{--quiet --play-and-exit --no-video-title-show --input-title-format=*TITLE* *VIDEO*},
novideo => q{--intf=dummy --novideo},
},
mpv => {
cmd => q{mpv},
srt => q{--sub-file=*SUB*},
audio => q{--audio-file=*AUDIO*},
fs => q{--fullscreen},
arg => q{--really-quiet --force-media-title=*TITLE* --no-ytdl *VIDEO*},
novideo => q{--no-video},
},
},

(
$constant{android}
? (
vlc => {
arg =>
"start -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -a android.intent.action.VIEW -d *VIDEO*",
cmd => "am",
fs => "",
novideo => "",
srt => "",
}
)
: (
vlc => {
cmd => q{vlc},
srt => q{--sub-file=*SUB*},
audio => q{--input-slave=*AUDIO*},
fs => q{--fullscreen},
arg => q{--quiet --play-and-exit --no-video-title-show --input-title-format=*TITLE* *VIDEO*},
novideo => q{--intf=dummy --novideo},
}
)
),

mpv => {
cmd => q{mpv},
srt => q{--sub-file=*SUB*},
audio => q{--audio-file=*AUDIO*},
fs => q{--fullscreen},
arg => q{--really-quiet --force-media-title=*TITLE* --no-ytdl *VIDEO*},
novideo => q{--no-video},
},
},

video_player_selected => (
$constant{win32}
($constant{win32} || $constant{android})
? 'vlc'
: undef # auto-defined
),

# YouTube options
dash_support => 1,
dash_segmented => 1, # may load slow
dash_support => $constant{android} ^ 1,
dash_segmented => 1, # may load slow
maxResults => 20,
hfr => 1,
resolution => 'best',
Expand Down
2 changes: 1 addition & 1 deletion lib/WWW/YoutubeViewer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ WWW::YoutubeViewer - A very easy interface to YouTube.
=cut

our $VERSION = '3.10.5';
our $VERSION = '3.10.6';

=head1 SYNOPSIS
Expand Down

0 comments on commit 89cd450

Please sign in to comment.