mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2024-11-13 04:19:03 +01:00
also add notifications in plain
This commit is contained in:
parent
045458d837
commit
bf69335aee
@ -114,6 +114,7 @@ usage()
|
||||
echo " weather,traffic,flashbriefing,goodmorning,singasong,tellstory,speak:'<text>'"
|
||||
echo " -b : connect/disconnect/list bluetooth device"
|
||||
echo " -q : query queue"
|
||||
echo " -n : query notifications"
|
||||
echo " -r : play tunein radio"
|
||||
echo " -s : play library track/library album"
|
||||
echo " -t : play Prime playlist"
|
||||
@ -245,6 +246,9 @@ while [ "$#" -gt 0 ] ; do
|
||||
-q)
|
||||
QUEUE="true"
|
||||
;;
|
||||
-n)
|
||||
NOTIFICATIONS="true"
|
||||
;;
|
||||
-lastalexa)
|
||||
LASTALEXA="true"
|
||||
;;
|
||||
@ -708,6 +712,18 @@ ${CURL} ${OPTS} -s -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep
|
||||
"https://${ALEXA}/api/media/state?deviceSerialNumber=${DEVICESERIALNUMBER}&deviceType=${DEVICETYPE}"
|
||||
echo
|
||||
}
|
||||
#
|
||||
# show notifications and alarms
|
||||
#
|
||||
show_notifications()
|
||||
{
|
||||
echo "/api/notifications"
|
||||
${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 "csrf: $(awk "\$0 ~/.${AMAZON}.*csrf[ \\s\\t]+/ {print \$7}" ${COOKIE})" -X GET \
|
||||
"https://${ALEXA}/api/notifications?deviceSerialNumber=${DEVICESERIALNUMBER}&deviceType=${DEVICETYPE}"
|
||||
echo
|
||||
}
|
||||
|
||||
#
|
||||
# deletes a multiroom device
|
||||
@ -856,6 +872,34 @@ if [ -n "$COMMAND" -o -n "$QUEUE" ] ; then
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
elif [ -n "$COMMAND" -o -n "$NOTIFICATIONS" ] ; then
|
||||
if [ "${DEVICE}" = "ALL" ] ; then
|
||||
while IFS= read -r DEVICE ; do
|
||||
set_var
|
||||
if [ -n "$COMMAND" ] ; then
|
||||
echo "sending cmd:${COMMAND} to dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} customerid:${MEDIAOWNERCUSTOMERID}"
|
||||
run_cmd
|
||||
# in order to prevent a "Rate exceeded" we need to delay the command
|
||||
sleep 1
|
||||
echo
|
||||
else
|
||||
echo "notifications info for dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER}"
|
||||
show_notifications
|
||||
echo
|
||||
fi
|
||||
done < ${DEVALL}
|
||||
else
|
||||
set_var
|
||||
if [ -n "$COMMAND" ] ; then
|
||||
echo "sending cmd:${COMMAND} to dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} customerid:${MEDIAOWNERCUSTOMERID}"
|
||||
run_cmd
|
||||
echo
|
||||
else
|
||||
echo "notifications info for dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER}"
|
||||
show_notifications
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
elif [ -n "$LEMUR" ] ; then
|
||||
DEVICE="${LEMUR}"
|
||||
set_var
|
||||
|
Loading…
Reference in New Issue
Block a user