From aa34df6f1ed6bf831c5f582101759560713f676f Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 20 Dec 2017 18:55:59 +0100 Subject: [PATCH] moved get_devlist after check_status --- alexa_remote_control.sh | 11 ++++++----- alexa_remote_control_plain.sh | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/alexa_remote_control.sh b/alexa_remote_control.sh index 4016c0e..54b0bc5 100644 --- a/alexa_remote_control.sh +++ b/alexa_remote_control.sh @@ -16,6 +16,7 @@ # 2017-12-07: v0.7b added Bluetooth connect/disconnect # 2017-12-18: v0.7c fixed US version # 2017-12-19: v0.7d fixed AWK csrf extraction on some systems +# 2017-12-20: v0.7e moved get_devlist after check_status # ### # @@ -618,17 +619,17 @@ if [ ! -f ${COOKIE} ] ; then log_in fi -if [ ! -f ${DEVLIST} ] ; then - echo "device list do not exist. downloading ..." - get_devlist -fi - check_status if [ $? -eq 0 ] ; then echo "cookie expired, logging in again ..." log_in fi +if [ ! -f ${DEVLIST} ] ; then + echo "device list do not exist. downloading ..." + get_devlist +fi + if [ -n "$COMMAND" -o -n "$QUEUE" ] ; then if [ "${DEVICE}" = "ALL" ] ; then for DEVICE in $(jq -r '.devices[] | select( .deviceFamily == "ECHO" or .deviceFamily == "WHA") | .accountName' ${DEVLIST} | sed -r 's/ /%20/g') ; do diff --git a/alexa_remote_control_plain.sh b/alexa_remote_control_plain.sh index 7f2ca37..fd48b88 100644 --- a/alexa_remote_control_plain.sh +++ b/alexa_remote_control_plain.sh @@ -3,7 +3,7 @@ # Amazon Alexa Remote Control (PLAIN shell) # alex(at)loetzimmer.de # -# 2017-12-19: v0.7d (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html) +# 2017-12-20: v0.7de(for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html) # ### # @@ -585,17 +585,17 @@ if [ ! -f ${COOKIE} ] ; then log_in fi -if [ ! -f ${DEVTXT} ] ; then - echo "device list do not exist. downloading ..." - get_devlist -fi - check_status if [ $? -eq 0 ] ; then echo "cookie expired, logging in again ..." log_in fi +if [ ! -f ${DEVTXT} ] ; then + echo "device list do not exist. downloading ..." + get_devlist +fi + if [ -n "$COMMAND" ] ; then set_var if [ -n "$COMMAND" ] ; then