playvideo_omx.sh
#!/bin/sh
# get rid of the cursor so we don't see it when videos are running
setterm -cursor off
# set here the path to the directory containing your videos
VIDEOPATH="/USB_video"
# you can normally leave this alone
SERVICE="omxplayer"
# now for our infinite loop!
while true; do
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
sleep 1;
else
for entry in $(find /USB_video/ -iname '*.mp4' | shuf -n 1);
do
clear
omxplayer -o both --win "-40 -40 800 600" $entry > /dev/null
done
fi
done