mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2024-11-14 04:49:03 +01:00
SPEAKVOL of 0 leaves the volume setting untouched
This commit is contained in:
parent
b41e2ed0bd
commit
b23043f58e
@ -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
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Amazon Alexa Remote Control (PLAIN shell)
|
||||
# alex(at)loetzimmer.de
|
||||
#
|
||||
# 2020-01-08: v0.15b (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
|
||||
# 2020-02-03: v0.15c (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
|
||||
#
|
||||
###
|
||||
#
|
||||
@ -51,7 +51,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"
|
||||
@ -321,9 +321,10 @@ case "$COMMAND" in
|
||||
fi
|
||||
;;
|
||||
speak:*)
|
||||
SEQUENCECMD='Alexa.Speak'
|
||||
TTS=$(echo ${COMMAND##*:} | sed -r 's/["\\]/ /g')
|
||||
TTS=",\\\"textToSpeak\\\":\\\"${TTS}\\\""
|
||||
TTS=',\"textToSpeak\":\"'${TTS}'\"'
|
||||
SEQUENCECMD='Alexa.Speak'
|
||||
SEQUENCEVAL=$TTS
|
||||
;;
|
||||
weather)
|
||||
SEQUENCECMD='Alexa.Weather.Play'
|
||||
@ -619,12 +620,14 @@ set_var()
|
||||
run_cmd()
|
||||
{
|
||||
if [ -n "${SEQUENCECMD}" ] ; then
|
||||
# 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 > 0
|
||||
if [ -n "${TTS}" -a $SPEAKVOL -gt 0 ] ; then
|
||||
SVOL=$SPEAKVOL
|
||||
|
||||
# Not using arrays here in order to be compatible with non-Bash
|
||||
|
Loading…
Reference in New Issue
Block a user