42 lines
664 B
Bash
Executable file
42 lines
664 B
Bash
Executable file
#!/bin/sh
|
|
|
|
folder="/mnt/video"
|
|
player="omxplayer"
|
|
|
|
swupgpio=23
|
|
swdowngpio=25
|
|
|
|
swupstat="$(command -v gpio read $swupgpio)"
|
|
|
|
if [ $# -eq 0 ]; then
|
|
echo "Parameter fehlt"
|
|
exit 1
|
|
fi
|
|
|
|
if [ $# -gt 1 ]; then
|
|
echo "Zu viele Parameter"
|
|
exit 1
|
|
fi
|
|
|
|
if [ $swupstat -eq 1 ]; then
|
|
exit 1
|
|
fi
|
|
|
|
if [ "buzzer" != "$1" ] && [ "cron" != "$1" ]; then
|
|
echo "Parameter muss \"buzzer\" oder \"cron\" sein"
|
|
exit 1
|
|
fi
|
|
|
|
if $(command -v pgrep) "$player" > /dev/null; then
|
|
if [ "$1" = "buzzer" ]; then
|
|
$(command -v pkill) "$player"
|
|
|
|
elif [ "$1" = "cron" ]; then
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
$(command -v "$player") "$(find "$folder" -maxdepth 1 -type f |sort -R |head -n1)" &
|
|
|
|
fi
|