diff --git a/gitnext/gitnext b/gitnext/gitnext index e63c661..5ee365a 100755 --- a/gitnext/gitnext +++ b/gitnext/gitnext @@ -27,7 +27,7 @@ Go to next revision =head1 AUTHOR -Copyright (C) 2017 Ole Tange, +Copyright (C) 2017-2024 Ole Tange, http://ole.tange.dk and Free Software Foundation, Inc. @@ -51,7 +51,7 @@ along with this program. If not, see . =head1 DEPENDENCIES -B uses B. +B uses B and B. =head1 SEE ALSO diff --git a/vid/vid b/vid/vid index 4e29b46..32c192f 100755 --- a/vid/vid +++ b/vid/vid @@ -5,7 +5,7 @@ =head1 NAME -vid - Play videos matching strings in descending order of size +vid - Play videos matching strings =head1 SYNOPSIS @@ -23,17 +23,49 @@ There can be multiple B expressions. The searching is cached in B<.vidlist> in a parent dir or in the current dir if no parents contain B<.vidlist>. +If stdin (standard input) is a tty: Match videos from B<.vidlist> +ordered by decreasing size. + +If stdin (standard input) is not a tty: Match videos from standard +input. + +If stdout (standard output) is a tty: Play 100 randomly chosen of the +matching videos. + +If stdout (standard output) is not a tty: List all matching videos. + +Videos in the dir B<.waste> are ignored. + =head1 EXAMPLE -Play videos matching B but not B: +Play 100 videos in random order matching B but not B: vid Documentary -v BBC +List all videos matching B but not B ordered by +decreasing size: + + vid Documentary -v BBC | cat + +Play all videos ending in B<.mp4>: + + ls *.mp4 | vid + +=head1 ENVIRONMENT VARIABLES + +=over 9 + +=item $VIDEOPLAYER + +Use this as video player. Default: vlc + +=back + =head1 AUTHOR -Copyright (C) 2018-2019 Ole Tange, +Copyright (C) 2018-2024 Ole Tange, http://ole.tange.dk and Free Software Foundation, Inc. @@ -118,6 +150,7 @@ cat_list() { full_path_vidlist_dir="$(dirname $(readlink -f "$vidlist") )" full_path_thisdir="$(readlink -f .)" if [ -f "$vidlist" ] ; then + # vidlist exists: Do the update in the background # find background (>/dev/null to detach from tty) update_list "$vidlist" "$full_path_vidlist_dir" >/dev/null & else @@ -128,7 +161,7 @@ cat_list() { perl -pe 's|\Q'"$full_path_vidlist_dir"'\E|.|')/" # cat "$vidlist" | grep matching this dir + remove dirs # echo "$vidlist" "$full_path_thisdir" "$full_path_vidlist_dir" = "$subdir" >&2 - cat "$vidlist" | + grep -v '/.waste/' "$vidlist" | perl -ne 's|^(\./)?\Q'"$subdir"'\E|| and print' } @@ -147,7 +180,12 @@ stdout() { # STDOUT = terminal # start $VIDEOPLAYER VIDEOPLAYER=${VIDEOPLAYER:-vlc --} - shuf | parallel --halt now,done=1 --lb -n100 -Xj1 $VIDEOPLAYER + if tty -s ; then + # STDIN is terminal => limit to 100 + shuf | parallel --halt now,done=1 --lb -n100 -Xj1 $VIDEOPLAYER + else + parallel --halt now,done=1 --lb -Xj1 $VIDEOPLAYER + fi else cat fi