forked from ChCh/RandomVideo
Plays a random video file from a defined folder
This commit is contained in:
commit
5314908aec
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
folder=/mnt/video
|
||||||
|
player=omxplayer
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Parameter fehlt"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -gt 1 ]; then
|
||||||
|
echo "Zu viele Parameter"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "buzzer" != "$1" -a "cron" != "$1" ]; then
|
||||||
|
echo "Parameter muss \"buzzer\" oder \"cron\" sein"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $(command -v pgrep) omxplayer > /dev/null; then
|
||||||
|
if [ "$1" = "buzzer" ]; then
|
||||||
|
$(command -v pkill) omxplayer
|
||||||
|
|
||||||
|
elif [ "$1" = "cron" ]; then
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
playerpath=$(command -v "$player")
|
||||||
|
$playerpath "$(find "$folder" -maxdepth 1 ! -name "$(basename $folder)"|sort -R |head -n1)" &
|
||||||
|
|
||||||
|
fi
|
Loading…
Reference in New Issue