From 6097e70c782e5c0882851dfc98e067b627c6e76c Mon Sep 17 00:00:00 2001 From: Martin Selbmann Date: Sat, 19 Sep 2020 23:33:19 +0200 Subject: [PATCH] support for on air switch --- RandomVideo.sh | 9 +++++++++ buzzer.sh | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/RandomVideo.sh b/RandomVideo.sh index c113856..bb346ce 100755 --- a/RandomVideo.sh +++ b/RandomVideo.sh @@ -3,6 +3,11 @@ folder=/mnt/video player=omxplayer +swupgpio=23 +swdowngpio=25 + +swupstat="$(command -v gpio read $swupgpio)" + if [ $# -eq 0 ]; then echo "Parameter fehlt" exit 1 @@ -13,6 +18,10 @@ if [ $# -gt 1 ]; then 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 diff --git a/buzzer.sh b/buzzer.sh index d423e94..9ab6f3a 100755 --- a/buzzer.sh +++ b/buzzer.sh @@ -5,6 +5,8 @@ strobogpio=2 swupgpio=23 swdowngpio=25 +player="omxplayer" + cmdgpio="$(command -v gpio)" $cmdgpio mode $buzzgpio in @@ -34,6 +36,10 @@ while true; do elif [ "$swupstat" -eq 1 ]; then + if $(command -v pgrep) "$player" > /dev/null; then + $(command -v pkill) "$player" + fi + while [ "$swupstat" -eq 1 ]; do if [ "$cmdonairstat" -eq 0 ]; then