D
D
Denis Verbin2015-05-19 14:29:20
linux
Denis Verbin, 2015-05-19 14:29:20

Where to add sort --random-sort to the script?

Hey! Where to add the option | sort --random-sort to randomize the video being played?

#!/bin/sh
VIDEOPATH="/mnt/storage/videos"
SERVICE="omxplayer"

while true; do
        if ps ax | grep -v grep | grep $SERVICE > /dev/null
        then
        sleep 1;
else
        for entry in $VIDEOPATH/*
        do
                clear
                omxplayer $entry > /dev/null
        done
fi
done

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konkase, 2015-05-19
@rez0n

#!/bin/sh
VIDEOPATH="/mnt/storage/videos"
SERVICE="omxplayer"

while true; do
        if ps ax | grep -v grep | grep $SERVICE > /dev/null
        then
        sleep 1;
else
        ln -1 $VIDEOPATH/* | sort --random-sort | while read entry
        do
                clear
                omxplayer "$entry" > /dev/null
        done
fi
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question