vid: Choose 100 next files - not 100 random files.
This commit is contained in:
parent
3b8d990b5d
commit
02896e1eb7
|
@ -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);
|
||||
|
|
8
vid/vid
8
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
|
||||
|
|
Loading…
Reference in a new issue