SPEAKVOL of 0 leaves the volume setting untouched

pull/102/head
Alex 2020-02-03 22:08:29 +01:00 committed by GitHub
commit 9b12ee2811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 13 deletions

View File

@ -15,7 +15,7 @@ OPTS - any cURL options you require
TMP - location of the temp dir
OATHTOOL - command line for oathtool MFA
MFA_SECRET- the MFA secret
SPEAKVOL - the volume for speak messages
SPEAKVOL - the volume for speak messages ( if set to 0, volume levels are left untouched)
NORMALVOL - if no current playing volume can be determined, fall back to normal volume
VOLMAXAGE - max. age in minutes before volume is re-read from API
DEVICEVOLNAME - a list of device names with specific volume settings (space separated)
@ -53,6 +53,7 @@ alexa-remote-control [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|
-a : list available devices
-m : delete multiroom and/or create new multiroom containing devices
-lastalexa : print device that received the last voice command
-login : Logs in, without further command (downloads cookie)
-z : print current volume level
-l : logoff
-h : help

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"
@ -197,7 +198,7 @@ usage()
while [ "$#" -gt 0 ] ; do
case "$1" in
--version)
echo "v0.15b"
echo "v0.15c"
exit 0
;;
-d)
@ -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

View File

@ -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"
@ -141,7 +141,7 @@ usage()
while [ "$#" -gt 0 ] ; do
case "$1" in
--version)
echo "v0.15b"
echo "v0.15c"
exit 0
;;
-d)
@ -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