added sound library

This commit is contained in:
Alex 2020-02-09 20:53:03 +01:00
parent 7b85b6dce4
commit 7dfd6ab6d6
3 changed files with 24 additions and 9 deletions

5
README.md Normal file → Executable file
View File

@ -21,6 +21,9 @@ VOLMAXAGE - max. age in minutes before volume is re-read from API
DEVICEVOLNAME - a list of device names with specific volume settings (space separated)
DEVICEVOLSPEAK - a list of speak volume levels - matching the devices above
DEVICEVOLNORMAL - a list of normal volume levels- matching the devices above
USE_ANNOUNCEMENT_FOR_SPEAK - Announcements can be made to multiple devices, while
regular SPEAK cannot but the announcement feature has
to be turned on for those devices. Also supports SSML!
```
You will very likely want to set the language to:
```
@ -36,7 +39,7 @@ alexa-remote-control [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|
-e : run command, additional SEQUENCECMDs:
weather,traffic,flashbriefing,goodmorning,singasong,tellstory,
speak:'<text>',automation:'<routine name>'
speak:'<text/ssml>',automation:'<routine name>,sound:<soundeffect_name>'
-b : connect/disconnect/list bluetooth device
-q : query queue
-n : query notifications

View File

@ -52,6 +52,8 @@
# 2020-02-03: v0.15c SPEAKVOL of 0 leaves the volume setting untouched
# 2020-02-09: v0.16 TTS to Multiroom groups via USE_ANNOUNCEMENT_FOR_SPEAK + SSML for TTS
# (!!! requires Announcement feature to be enabled in each device !!!)
# 2020-02-09: v0.16a added sound library - only very few sounds are actually supported
# ( https://developer.amazon.com/en-US/docs/alexa/custom-skills/ask-soundlibrary.html )
#
###
#
@ -179,7 +181,8 @@ usage()
echo " -i | -p | -P | -S | -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -z | -l | -h"
echo
echo " -e : run command, additional SEQUENCECMDs:"
echo " weather,traffic,flashbriefing,goodmorning,singasong,tellstory,speak:'<text>',automation:'<routine name>'"
echo " weather,traffic,flashbriefing,goodmorning,singasong,tellstory,"
echo " speak:'<text/ssml>',automation:'<routine name>',sound:<soundeffect_name>"
echo " -b : connect/disconnect/list bluetooth device"
echo " -q : query queue"
echo " -n : query notifications"
@ -205,7 +208,7 @@ usage()
while [ "$#" -gt 0 ] ; do
case "$1" in
--version)
echo "v0.16"
echo "v0.16a"
exit 0
;;
-d)
@ -413,6 +416,10 @@ case "$COMMAND" in
SEQUENCEVAL=$TTS
fi
;;
sound:*)
SEQUENCECMD='Alexa.Sound'
SEQUENCEVAL=',\"soundStringId\":\"'${COMMAND##sound:}'\"'
;;
automation:*)
SEQUENCECMD='automation'
UTTERANCE=$(echo ${COMMAND##automation:} | sed -r 's/["\\]/ /g')
@ -635,7 +642,7 @@ if [ -n "${SEQUENCECMD}" ] ; then
ALEXACMD='{"behaviorId":"'${AUTOMATION}'","sequenceJson":"'${SEQUENCE}'","status":"ENABLED"}'
else
# SequenceCommands are generally not supported on WHA devices
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory" ; then
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|sound" ; then
if [ "${DEVICEFAMILY}" = "WHA" ] ; then
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
return

View File

@ -3,7 +3,7 @@
# Amazon Alexa Remote Control (PLAIN shell)
# alex(at)loetzimmer.de
#
# 2020-02-03: v0.15c (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
# 2020-02-09: v0.16a (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
#
###
#
@ -52,7 +52,7 @@ SET_OATHTOOL='/usr/bin/oathtool'
SET_TMP="/tmp"
# Volume for speak commands (a SPEAKVOL of 0 leaves the volume settings untouched)
SET_SPEAKVOL="30"
SET_SPEAKVOL="0"
# if no current playing volume can be determined, fall back to normal volume
SET_NORMALVOL="10"
@ -120,7 +120,8 @@ usage()
echo " -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -l | -h"
echo
echo " -e : run command, additional SEQUENCECMDs:"
echo " weather,traffic,flashbriefing,goodmorning,singasong,tellstory,speak:'<text>'"
echo " weather,traffic,flashbriefing,goodmorning,singasong,tellstory,"
echo " speak:'<text>'sound:<soundeffect_name>"
echo " -b : connect/disconnect/list bluetooth device"
echo " -q : query queue"
echo " -n : query notifications"
@ -141,7 +142,7 @@ usage()
while [ "$#" -gt 0 ] ; do
case "$1" in
--version)
echo "v0.15c"
echo "v0.16a"
exit 0
;;
-d)
@ -326,6 +327,10 @@ case "$COMMAND" in
SEQUENCECMD='Alexa.Speak'
SEQUENCEVAL=$TTS
;;
sound:*)
SEQUENCECMD='Alexa.Sound'
SEQUENCEVAL=',\"soundStringId\":\"'${COMMAND##sound:}'\"'
;;
weather)
SEQUENCECMD='Alexa.Weather.Play'
;;
@ -620,7 +625,7 @@ set_var()
run_cmd()
{
if [ -n "${SEQUENCECMD}" ] ; then
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|speak" ; then
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|speak|sound" ; then
if [ "${DEVICEFAMILY}" = "WHA" ] ; then
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
return