fixed new API endpoint for automations

pull/117/head
Alex 2021-01-28 21:31:27 +01:00
parent 6345f416c5
commit 8ceb743611
1 changed files with 4 additions and 2 deletions

View File

@ -61,6 +61,8 @@
# ( https://github.com/thorsten-gehrig/alexa-remote-control/issues/108 ) # ( https://github.com/thorsten-gehrig/alexa-remote-control/issues/108 )
# 2020-12-12: v0.17a sounds now benefit from SPEAKVOL # 2020-12-12: v0.17a sounds now benefit from SPEAKVOL
# fixed TuneIn IDs to also play podcasts # fixed TuneIn IDs to also play podcasts
# 2021-01-28: v0.17b fixed new API endpoint for automations
# (thanks to Michael Winkler)
# #
### ###
# #
@ -218,7 +220,7 @@ usage()
while [ "$#" -gt 0 ] ; do while [ "$#" -gt 0 ] ; do
case "$1" in case "$1" in
--version) --version)
echo "v0.17a" echo "v0.17b"
exit 0 exit 0
;; ;;
-d) -d)
@ -643,7 +645,7 @@ if [ -n "${SEQUENCECMD}" ] ; then
${CURL} ${OPTS} -s -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L\ ${CURL} ${OPTS} -s -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L\
-H "Content-Type: application/json; charset=UTF-8" -H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\ -H "Content-Type: application/json; charset=UTF-8" -H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\
-H "csrf: $(awk "\$0 ~/.${AMAZON}.*csrf[ \\s\\t]+/ {print \$7}" ${COOKIE})" -X GET \ -H "csrf: $(awk "\$0 ~/.${AMAZON}.*csrf[ \\s\\t]+/ {print \$7}" ${COOKIE})" -X GET \
"https://${ALEXA}/api/behaviors/automations?limit=200" > "${TMP}/.alexa.automation" "https://${ALEXA}/api/behaviors/v2/automations?limit=200" > "${TMP}/.alexa.automation"
AUTOMATION=$(jq --arg utterance "${UTTERANCE}" -r '.[] | select( .triggers[].payload.utterance == $utterance) | .automationId' "${TMP}/.alexa.automation") AUTOMATION=$(jq --arg utterance "${UTTERANCE}" -r '.[] | select( .triggers[].payload.utterance == $utterance) | .automationId' "${TMP}/.alexa.automation")
if [ -z "${AUTOMATION}" ] ; then if [ -z "${AUTOMATION}" ] ; then