#!/bin/sh # SPDX-License-Identifier: Unlicense folder="/mnt/video" player="cvlc" playerparam="--play-and-exit --quiet --no-osd -A alsa --alsa-audio-device=front:CARD=Device,DEV=0" pgrepplayer="vlc" swupgpio=23 playerfull="$(command -v $player) $playerparam" 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 pgrep "$pgrepplayer" > /dev/null; then if [ "$1" = "buzzer" ]; then pkill "$pgrepplayer" elif [ "$1" = "cron" ]; then exit 1 fi else $playerfull "$(find "$folder" -maxdepth 1 -type f |sort -R |head -n1)" & fi