SPEAKVOL of 0 leaves the volume setting untouched

This commit is contained in:
Alex
2020-02-03 21:58:45 +01:00
parent b41e2ed0bd
commit b23043f58e
2 changed files with 17 additions and 10 deletions
+8 -4
View File
@@ -49,6 +49,7 @@
# 2019-12-30: v0.15 re-worked the volume setting for TTS commands
# 2020-01-03: v0.15a introduce some proper "get_volume"
# 2020-01-08: v0.15b cleaned merge errors
# 2020-02-03: v0.15c SPEAKVOL of 0 leaves the volume setting untouched
#
###
#
@@ -97,7 +98,7 @@ SET_OATHTOOL='/usr/bin/oathtool'
# tmp path
SET_TMP="/tmp"
# Volume for speak commands
# Volume for speak commands (a SPEAKVOL of 0 leaves the volume settings untouched)
SET_SPEAKVOL="30"
# if no current playing volume can be determined, fall back to normal volume
SET_NORMALVOL="10"
@@ -392,9 +393,10 @@ case "$COMMAND" in
fi
;;
speak:*)
SEQUENCECMD='Alexa.Speak'
TTS=$(echo ${COMMAND##*:} | sed -r 's/["\\]/ /g')
TTS=',\"textToSpeak\":\"'${TTS}'\"'
SEQUENCECMD='Alexa.Speak'
SEQUENCEVAL=$TTS
;;
automation:*)
SEQUENCECMD='automation'
@@ -617,12 +619,14 @@ if [ -n "${SEQUENCECMD}" ] ; then
ALEXACMD='{"behaviorId":"'${AUTOMATION}'","sequenceJson":"'${SEQUENCE}'","status":"ENABLED"}'
else
# the speak command is treated differently in that the wolume gets set to $SPEAKVOL
if [ -n "${TTS}" ] ; then
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|speak" ; then
if [ "${DEVICEFAMILY}" = "WHA" ] ; then
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
return
fi
fi
# the speak command is treated differently if $SPEAKVOL is > 0
if [ -n "${TTS}" -a $SPEAKVOL -gt 0 ] ; then
SVOL=$SPEAKVOL
# Not using arrays here in order to be compatible with non-Bash