update README.md

parse config parameters with jq from config.json
This commit is contained in:
Martin Selbmann 2020-09-24 10:40:46 +02:00
parent d98723df33
commit 4a01d1eed4
3 changed files with 39 additions and 21 deletions

View File

@ -25,7 +25,7 @@
* placeholder videofile for "On Air"-Message * placeholder videofile for "On Air"-Message
### config.json ### config.json
* the config file in future * configfile with all config parameters
### volumetest.sh ### volumetest.sh
* testscript for ramping soundcard output volume * testscript for ramping soundcard output volume

View File

@ -1,15 +1,24 @@
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: Unlicense # SPDX-License-Identifier: Unlicense
folder="/mnt/video" cmdjq="$(command -v jq)"
player="cvlc"
playerparam="--play-and-exit --quiet --no-osd -A alsa --alsa-audio-device=front:CARD=Device,DEV=0"
pgrepplayer="vlc"
swupgpio=23 if [ -z "$cmdjq" ]; then
i echo "Missing \"jq\"!"
exit 1
fi
configfile="config.json"
folder="$($cmdjq -r ".RandomVideo | .folder" $configfile)"
player="$($cmdjq -r ".player" $configfile)"
playerparam="$($cmdjq -r ".playerparam" $configfile)"
pgrepplayer="$($cmdjq -r ".pgrepplayer" $configfile)"
swupgpio="$($cmdjq -r ".swupgpio" $configfile)"
playerfull="$(command -v $player) $playerparam" playerfull="$(command -v $player) $playerparam"
swupstat=$($(command -v gpio) read $swupgpio) swupstat="$($(command -v gpio) read $swupgpio)"
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "Parameter fehlt" echo "Parameter fehlt"

View File

@ -1,24 +1,33 @@
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: Unlicense # SPDX-License-Identifier: Unlicense
buzzergpio=0 cmdjq="$(command -v jq)"
strobegpio=2
swupgpio=23
swdowngpio=25
player="cvlc" if [ -z "$cmdjq" ]; then
playerparam="--play-and-exit --quiet --no-osd -A alsa --alsa-audio-device=front:CARD=Device,DEV=0" echo "Missing \"jq\"!"
playerloop="--loop" exit 1
fi
pgrepplayer="vlc" configfile="config.json"
pollingtime=0.05 buzzergpio="$(§cmdjq -r ".buzzer | .buzzergpio" $configfile)"
buzzertimeout=2 strobegpio="$(§cmdjq -r ".buzzer | .strobegpio" $configfile)"
strobeduration=1 swupgpio="$(§cmdjq -r ".swupgpio" $configfile)"
swdowngpio="$(§cmdjq -r ".buzzer | .swdowngpio" $configfile)"
volumetimeout=0.1 player="$(§cmdjq -r ".player" $configfile)"
volumedelay=0.1 playerparam="$(§cmdjq -r ".playerparam" $configfile)"
volumemax=60 playerloop="$(§cmdjq -r ".buzzer | .playerloop" $configfile)"
pgrepplayer="$(§cmdjq -r ".pgrepplayer" $configfile)"
pollingtime="$(§cmdjq -r ".buzzer | .pollingtime" $configfile)"
buzzertimeout="$(§cmdjq -r ".buzzer | .buzzertimeout" $configfile)"
strobeduration="$(§cmdjq -r ".buzzer | .strobeduration" $configfile)"
volumetimeout="$(§cmdjq -r ".buzzer | .volumetimeout" $configfile)"
volumedelay="$(§cmdjq -r ".buzzer | .volumedelay" $configfile)"
volumemax="$(§cmdjq -r ".buzzer | .volumemax" $configfile)"
playerfull="$(command -v $player) $playerparam" playerfull="$(command -v $player) $playerparam"
cmdgpio="$(command -v gpio)" cmdgpio="$(command -v gpio)"