From 02896e1eb7a8c15eaf183caeba7cd8c898ac13b3 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sun, 29 Dec 2024 02:58:15 +0100 Subject: [PATCH] vid: Choose 100 next files - not 100 random files. --- rrm/rclean | 4 ++++ vid/vid | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/rrm/rclean b/rrm/rclean index d7f0980..030c156 100755 --- a/rrm/rclean +++ b/rrm/rclean @@ -38,6 +38,10 @@ close RRM; for my $size (keys %rrm) { for my $file (@{$size{$size}}) { if(-e $file) { + if($opt::sizeonly) { + print "$file\n"; + next; + } my $md5 = Digest::MD5->new; $md5->addpath($file); my $sha = Digest::SHA->new(256); diff --git a/vid/vid b/vid/vid index 0fbabcb..0064450 100755 --- a/vid/vid +++ b/vid/vid @@ -181,7 +181,13 @@ stdout() { VIDEOPLAYER=${VIDEOPLAYER:-vlc --} if $stdin_is_terminal ; then # STDIN is terminal => limit to 100 - shuf | parallel --halt now,done=1 --lb -n100 -Xj1 $VIDEOPLAYER + # shuf | parallel --halt now,done=1 --lb -n100 -Xj1 $VIDEOPLAYER + # Sort file name, select random starting point, print 100 next paths. + perl -e '$n = 100; + @l = sort { (split m{/}, $a)[-1] cmp (split m{/}, $b)[-1] } <>; + $r = rand(@l - --$n); + print @l[$r..($r+$n)];' | + parallel --halt now,done=1 --lb -n100 -Xj1 $VIDEOPLAYER else parallel --halt now,done=1 --lb -Xj1 $VIDEOPLAYER fi