2020-08-23 01:33:37 +02:00
|
|
|
#!/bin/sh
|
2020-09-23 15:18:30 +02:00
|
|
|
# SPDX-License-Identifier: Unlicense
|
2020-08-23 01:33:37 +02:00
|
|
|
|
2020-09-19 23:43:23 +02:00
|
|
|
folder="/mnt/video"
|
2020-09-22 18:16:47 +02:00
|
|
|
player="cvlc"
|
2020-09-22 22:05:36 +02:00
|
|
|
playerparam="--play-and-exit --quiet --no-osd -A alsa --alsa-audio-device=front:CARD=Device,DEV=0"
|
2020-09-22 18:25:58 +02:00
|
|
|
pgrepplayer="vlc"
|
2020-08-23 01:33:37 +02:00
|
|
|
|
2020-09-19 23:33:19 +02:00
|
|
|
swupgpio=23
|
|
|
|
|
2020-09-23 15:18:30 +02:00
|
|
|
playerfull="$(command -v $player) $playerparam"
|
2020-09-19 23:49:29 +02:00
|
|
|
swupstat=$($(command -v gpio) read $swupgpio)
|
2020-09-19 23:33:19 +02:00
|
|
|
|
2020-08-23 01:33:37 +02:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo "Parameter fehlt"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $# -gt 1 ]; then
|
|
|
|
echo "Zu viele Parameter"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-09-23 15:18:30 +02:00
|
|
|
if [ "$swupstat" -eq 1 ]; then
|
2020-09-19 23:33:19 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-08-23 04:18:37 +02:00
|
|
|
if [ "buzzer" != "$1" ] && [ "cron" != "$1" ]; then
|
2020-08-23 01:33:37 +02:00
|
|
|
echo "Parameter muss \"buzzer\" oder \"cron\" sein"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-09-23 15:18:30 +02:00
|
|
|
if pgrep "$pgrepplayer" > /dev/null; then
|
2020-08-23 01:33:37 +02:00
|
|
|
if [ "$1" = "buzzer" ]; then
|
2020-09-23 15:18:30 +02:00
|
|
|
pkill "$pgrepplayer"
|
2020-08-23 01:33:37 +02:00
|
|
|
|
|
|
|
elif [ "$1" = "cron" ]; then
|
2020-08-23 04:08:43 +02:00
|
|
|
exit 1
|
2020-08-23 01:33:37 +02:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
2020-09-23 15:18:30 +02:00
|
|
|
$playerfull "$(find "$folder" -maxdepth 1 -type f |sort -R |head -n1)" &
|
2020-08-23 01:33:37 +02:00
|
|
|
|
|
|
|
fi
|