Skip to content

Commit be616a1

Browse files
committed
- Made --autoplay a boolean option. (#263)
The autoplay-mode (if enabled in the config) can now be disabled with `--no-autoplay`.
1 parent 1460cc5 commit be616a1

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

bin/youtube-viewer

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,7 @@ usage: $execname [options] ([url] | [keywords])
771771
-B --backwards! : play the video results in reverse order
772772
-s --shuffle! : shuffle the results of videos and playlists
773773
-I --interactive! : interactive mode, prompting for user input
774-
--autoplay : autoplay mode, automatically playing related videos
775-
--autoplay=s : autoplay mode, starting from a given video ID
774+
--autoplay! : autoplay mode, automatically playing related videos
776775
--std-input=s : use this value as the first standard input
777776
--max-seconds=i : ignore videos longer than i seconds
778777
--min-seconds=i : ignore videos shorter than i seconds
@@ -1352,17 +1351,6 @@ sub apply_configuration {
13521351
if (defined $opt->{print_video_info}) {
13531352
get_and_print_video_info(split(/[,\s]+/, delete $opt->{print_video_info}));
13541353
}
1355-
1356-
if (defined $opt->{autoplay}) {
1357-
my $value = delete $opt->{autoplay};
1358-
if (($value =~ /$get_video_id_re/ or $value =~ /$valid_video_id_re/) and not @{$keywords}) {
1359-
autoplay($value);
1360-
}
1361-
else {
1362-
$opt{autoplay_mode} = 1;
1363-
unshift(@{$keywords}, $value) if length($value);
1364-
}
1365-
}
13661354
}
13671355

13681356
sub parse_arguments {
@@ -1446,7 +1434,7 @@ sub parse_arguments {
14461434
'playlists|p|pl|playlist:s' => \$opt{search_playlists},
14471435
'pid|playlist-id=s' => \$opt{playlist_id},
14481436

1449-
'autoplay:s' => \$opt{autoplay},
1437+
'autoplay!' => \$opt{autoplay_mode},
14501438

14511439
'play-playlists|pp=s' => \$opt{play_playlists},
14521440
'debug:1' => \$opt{debug},

0 commit comments

Comments
 (0)