Skip to content

Instantly share code, notes, and snippets.

@ddn
Created June 16, 2020 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddn/f5dbd9304d0a0162430e7c0e3eb35ee1 to your computer and use it in GitHub Desktop.
Save ddn/f5dbd9304d0a0162430e7c0e3eb35ee1 to your computer and use it in GitHub Desktop.
#!/bin/sh
# get rid of the cursor so we don't see it when videos are running
# set here the path to the directory containing your videos
VIDEOPATH="/media/usb/"
# 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 $VIDEOPATH/*
IFS=''
find $VIDEOPATH -maxdepth 1 -iname '*' -type f -not -path '*/\.*'| shuf | while read entry
do
# clear
echo -n $entry | xargs -0 omxplayer -r --no-osd --aspect-mode fill > /dev/null 2>&1
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment