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
### config.json
* the config file in future
* configfile with all config parameters
### volumetest.sh
* testscript for ramping soundcard output volume

View File

@ -1,15 +1,24 @@
#!/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"
cmdjq="$(command -v jq)"
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"
swupstat=$($(command -v gpio) read $swupgpio)
swupstat="$($(command -v gpio) read $swupgpio)"
if [ $# -eq 0 ]; then
echo "Parameter fehlt"

View File

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