Merge pull request #90 from adn77/master

added sound library
pull/102/head
Alex 2020-02-09 21:06:00 +01:00 committed by GitHub
commit 6823165a8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) DEVICEVOLNAME - a list of device names with specific volume settings (space separated)
DEVICEVOLSPEAK - a list of speak volume levels - matching the devices above DEVICEVOLSPEAK - a list of speak volume levels - matching the devices above
DEVICEVOLNORMAL - a list of normal 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: 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: -e : run command, additional SEQUENCECMDs:
weather,traffic,flashbriefing,goodmorning,singasong,tellstory, 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 -b : connect/disconnect/list bluetooth device
-q : query queue -q : query queue
-n : query notifications -n : query notifications

View File

@ -52,6 +52,8 @@
# 2020-02-03: v0.15c SPEAKVOL of 0 leaves the volume setting untouched # 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 # 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 !!!) # (!!! 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 " -i | -p | -P | -S | -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -z | -l | -h"
echo echo
echo " -e : run command, additional SEQUENCECMDs:" 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 " -b : connect/disconnect/list bluetooth device"
echo " -q : query queue" echo " -q : query queue"
echo " -n : query notifications" echo " -n : query notifications"
@ -205,7 +208,7 @@ usage()
while [ "$#" -gt 0 ] ; do while [ "$#" -gt 0 ] ; do
case "$1" in case "$1" in
--version) --version)
echo "v0.16" echo "v0.16a"
exit 0 exit 0
;; ;;
-d) -d)
@ -413,6 +416,10 @@ case "$COMMAND" in
SEQUENCEVAL=$TTS SEQUENCEVAL=$TTS
fi fi
;; ;;
sound:*)
SEQUENCECMD='Alexa.Sound'
SEQUENCEVAL=',\"soundStringId\":\"'${COMMAND##sound:}'\"'
;;
automation:*) automation:*)
SEQUENCECMD='automation' SEQUENCECMD='automation'
UTTERANCE=$(echo ${COMMAND##automation:} | sed -r 's/["\\]/ /g') UTTERANCE=$(echo ${COMMAND##automation:} | sed -r 's/["\\]/ /g')
@ -635,7 +642,7 @@ if [ -n "${SEQUENCECMD}" ] ; then
ALEXACMD='{"behaviorId":"'${AUTOMATION}'","sequenceJson":"'${SEQUENCE}'","status":"ENABLED"}' ALEXACMD='{"behaviorId":"'${AUTOMATION}'","sequenceJson":"'${SEQUENCE}'","status":"ENABLED"}'
else else
# SequenceCommands are generally not supported on WHA devices # 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 if [ "${DEVICEFAMILY}" = "WHA" ] ; then
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}" echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
return return

View File

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