Now you can pass an URL to the the thing and it will play the video

This commit is contained in:
qorg11 2021-11-07 15:24:48 +01:00
parent d0faacb85a
commit 7f3c79c6d8
No known key found for this signature in database
GPG key ID: 343FC20A4ACA62B9

View file

@ -53,6 +53,15 @@ if (!$ARGV[0]) {
my $response;
my $uuid = -1;
my @selected_video_data;
if ($input =~ /^http(s):\/\/.*/) {
my $uuid = $input;
$uuid =~ s/\/.w\///;
$uuid =~ s/\/videos\/watch//;
my ($tmp_instance) = $input =~ m!(https?://[^:/]+)!;
$config{instance} = $tmp_instance;
@selected_video_data = get_video_data($uuid);
}
while ($uuid == -1) {
$response = search_video($config{instance}, $input, $counter);
if ($response eq "-1") {
@ -65,11 +74,18 @@ if (!$ARGV[0]) {
play_video(\@selected_video_data);
} else {
my $response;
my $uuid = -1;
my @selected_video_data;
$input = join("",@ARGV);
if ($input =~ /^http(s):\/\/.*/) {
my $uuid = $input;
$uuid =~ s/\/.w\///;
$uuid =~ s/\/videos\/watch//;
my ($tmp_instance) = $input =~ m!(https?://[^:/]+)!;
$config{instance} = $tmp_instance;
@selected_video_data = get_video_data($uuid);
}
while ($uuid == -1) {
$response = search_video($config{instance}, $input, $counter);
if ($response eq "-1") {
@ -123,15 +139,14 @@ sub select_video($) {
} elsif ($prompt_input eq ":h") {
&help_prompt();
return -1;
} elsif($prompt_input =~ /^:s/) {
} elsif ($prompt_input =~ /^:s/) {
$prompt_input =~ s/^:s //;
return -1;
} elsif($prompt_input =~ /^:i/) {
} elsif ($prompt_input =~ /^:i/) {
$config{instance} = $prompt_input;
$config{instance} =~ s/^:i //;
return -1;
}
}
return "$videos_data[$input]->{uuid}";
}