forked from ChCh/RandomVideo
34 lines
542 B
Bash
Executable File
34 lines
542 B
Bash
Executable File
#!/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
|
|
$(command -v "$player") "$(find "$folder" -maxdepth 1 -type f |sort -R |head -n1)" &
|
|
|
|
fi
|