pipe-viewer-copy.diff (2467B)
1 diff --git a/bin/pipe-viewer b/bin/pipe-viewer 2 index b98db2f..c1bea19 100644 3 --- a/bin/pipe-viewer 4 +++ b/bin/pipe-viewer 5 @@ -3462,6 +3462,21 @@ sub print_playlists { 6 } 7 } 8 9 + elsif ($opt =~ /^c(?:opy)?${digit_or_equal_re}(.*)/) { 10 + if (my @nums = get_valid_numbers($#{$playlists}, $1)) { 11 + foreach my $num (@nums) { 12 + my $id1 = sprintf($opt{youtube_playlist_url}, $yv_utils->get_playlist_id($playlists->[$num])); 13 + print STDOUT $id1; 14 + my $cmdstring = sprintf("echo -n \"%s\" | xclip -selection clipboard", $id1); 15 + system($cmdstring); 16 + } 17 + press_enter_to_continue(); 18 + } 19 + else { 20 + warn_no_thing_selected('video'); 21 + } 22 + } 23 + 24 # :pp=i 25 elsif ($opt =~ /^pp${digit_or_equal_re}(.*)/) { 26 if (my @ids = get_valid_numbers($#{$playlists}, $1)) { 27 @@ -4688,7 +4703,7 @@ sub print_videos { 28 warn colored("\n[!] The playlist is empty!", 'bold red') . "\n"; 29 } 30 } 31 - elsif ($opt =~ /^c(?:omments?)?${digit_or_equal_re}(.*)/) { 32 + elsif ($opt =~ /^comments?${digit_or_equal_re}(.*)/) { 33 if (my @nums = get_valid_numbers($#{$videos}, $1)) { 34 get_and_print_comments(map { $yv_utils->get_video_id($videos->[$_]) } @nums); 35 } 36 @@ -4752,6 +4767,20 @@ sub print_videos { 37 warn_no_thing_selected('video'); 38 } 39 } 40 + elsif ($opt =~ /^c(?:opy)?${digit_or_equal_re}(.*)/) { 41 + if (my @nums = get_valid_numbers($#{$videos}, $1)) { 42 + foreach my $num (@nums) { 43 + my $id1 = sprintf($opt{youtube_video_url}, $yv_utils->get_video_id($videos->[$num])); 44 + print STDOUT $id1; 45 + my $cmdstring = sprintf("echo -n \"%s\" | xclip -selection clipboard", $id1); 46 + system($cmdstring); 47 + } 48 + press_enter_to_continue(); 49 + } 50 + else { 51 + warn_no_thing_selected('video'); 52 + } 53 + } 54 elsif ($opt eq 'anp') { # auto-next-page 55 $opt{auto_next_page} = 1; 56 }