mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2024-11-22 08:49:02 +01:00
repeat command and environment variable parsing
* added repeat command * added environment variable parsing
This commit is contained in:
parent
c5975dae43
commit
7ec60e720d
@ -34,7 +34,8 @@
|
|||||||
# https://github.com/openhab/openhab2-addons/tree/master/addons/binding/org.openhab.binding.amazonechocontrol
|
# https://github.com/openhab/openhab2-addons/tree/master/addons/binding/org.openhab.binding.amazonechocontrol
|
||||||
# (thanks to Ralf Otto for implementing this feature in this script)
|
# (thanks to Ralf Otto for implementing this feature in this script)
|
||||||
# 2018-06-13: v0.10a added album play of imported library
|
# 2018-06-13: v0.10a added album play of imported library
|
||||||
# 2018-06-18: v0.10b added Alex routine execution
|
# 2018-06-18: v0.10b added Alexa routine execution
|
||||||
|
# 2019-01-22: v0.11 added repeat command, added environment variable parsing
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
@ -45,35 +46,50 @@
|
|||||||
#
|
#
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
EMAIL='amazon_account@email.address'
|
SET_EMAIL='amazon_account@email.address'
|
||||||
PASSWORD='Very_Secret_Amazon_Account_Password'
|
SET_PASSWORD='Very_Secret_Amazon_Account_Password'
|
||||||
|
|
||||||
LANGUAGE="de-DE"
|
SET_LANGUAGE="de-DE"
|
||||||
#LANGUAGE="en-US"
|
#SET_LANGUAGE="en-US"
|
||||||
|
|
||||||
AMAZON='amazon.de'
|
SET_AMAZON='amazon.de'
|
||||||
#AMAZON='amazon.com'
|
#SET_AMAZON='amazon.com'
|
||||||
|
|
||||||
ALEXA='layla.amazon.de'
|
SET_ALEXA='alexa.amazon.de'
|
||||||
#ALEXA='pitangui.amazon.com'
|
#SET_ALEXA='pitangui.amazon.com'
|
||||||
|
|
||||||
# cURL binary
|
# cURL binary
|
||||||
CURL='/usr/bin/curl'
|
SET_CURL='/usr/bin/curl'
|
||||||
|
|
||||||
# cURL options
|
# cURL options
|
||||||
# -k : if your cURL cannot verify CA certificates, you'll have to trust any
|
# -k : if your cURL cannot verify CA certificates, you'll have to trust any
|
||||||
# --compressed : if your cURL was compiled with libz you may use compression
|
# --compressed : if your cURL was compiled with libz you may use compression
|
||||||
# --http1.1 : cURL defaults to HTTP/2 on HTTPS connections if available
|
# --http1.1 : cURL defaults to HTTP/2 on HTTPS connections if available
|
||||||
OPTS='--compressed --http1.1'
|
SET_OPTS='--compressed --http1.1'
|
||||||
#OPTS='-k --compressed --http1.1'
|
#SET_OPTS='-k --compressed --http1.1'
|
||||||
|
|
||||||
# browser identity
|
# browser identity
|
||||||
BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0'
|
SET_BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:1.0) bash-script/1.0'
|
||||||
|
#SET_BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0'
|
||||||
|
|
||||||
|
# tmp path
|
||||||
|
SET_TMP="/tmp"
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# nothing to configure below here
|
# nothing to configure below here
|
||||||
#
|
#
|
||||||
TMP="/tmp"
|
|
||||||
|
# retrieving environment variables if any are set
|
||||||
|
EMAIL=${EMAIL:-$SET_EMAIL}
|
||||||
|
PASSWORD=${PASSWORD:-$SET_PASSWORD}
|
||||||
|
AMAZON=${AMAZON:-$SET_AMAZON}
|
||||||
|
ALEXA=${ALEXA:-$SET_ALEXA}
|
||||||
|
LANGUAGE=${LANGUAGE:-$SET_LANGUAGE}
|
||||||
|
BROWSER=${BROWSER:-$SET_BROWSER}
|
||||||
|
CURL=${CURL:-$SET_CURL}
|
||||||
|
OPTS=${OPTS:-$SET_OPTS}
|
||||||
|
TMP=${TMP:-$SET_TMP}
|
||||||
|
|
||||||
COOKIE="${TMP}/.alexa.cookie"
|
COOKIE="${TMP}/.alexa.cookie"
|
||||||
DEVLIST="${TMP}/.alexa.devicelist.json"
|
DEVLIST="${TMP}/.alexa.devicelist.json"
|
||||||
|
|
||||||
@ -102,7 +118,7 @@ LASTALEXA=""
|
|||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
echo "$0 [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|vol:<0-100>> |"
|
echo "$0 [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|repeat|vol:<0-100>> |"
|
||||||
echo " -b [list|<\"AA:BB:CC:DD:EE:FF\">] | -q | -r <\"station name\"|stationid> |"
|
echo " -b [list|<\"AA:BB:CC:DD:EE:FF\">] | -q | -r <\"station name\"|stationid> |"
|
||||||
echo " -s <trackID|'Artist' 'Album'> | -t <ASIN> | -u <seedID> | -v <queueID> | -w <playlistId> |"
|
echo " -s <trackID|'Artist' 'Album'> | -t <ASIN> | -u <seedID> | -v <queueID> | -w <playlistId> |"
|
||||||
echo " -i | -p | -P | -S | -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -l | -h"
|
echo " -i | -p | -P | -S | -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -l | -h"
|
||||||
@ -296,6 +312,9 @@ case "$COMMAND" in
|
|||||||
shuffle)
|
shuffle)
|
||||||
COMMAND='{"type":"ShuffleCommand","shuffle":"true"}'
|
COMMAND='{"type":"ShuffleCommand","shuffle":"true"}'
|
||||||
;;
|
;;
|
||||||
|
repeat)
|
||||||
|
COMMAND='{"type":"RepeatCommand","repeat":true}'
|
||||||
|
;;
|
||||||
vol:*)
|
vol:*)
|
||||||
VOL=${COMMAND##*:}
|
VOL=${COMMAND##*:}
|
||||||
# volume as integer!
|
# volume as integer!
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# Amazon Alexa Remote Control (PLAIN shell)
|
# Amazon Alexa Remote Control (PLAIN shell)
|
||||||
# alex(at)loetzimmer.de
|
# alex(at)loetzimmer.de
|
||||||
#
|
#
|
||||||
# 2018-06-18: v0.10b (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
|
# 2019-01-22: v0.11 (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
@ -13,35 +13,51 @@
|
|||||||
#
|
#
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
EMAIL='amazon_account@email.address'
|
|
||||||
PASSWORD='Very_Secret_Amazon_Account_Password'
|
|
||||||
|
|
||||||
LANGUAGE="de-DE"
|
SET_EMAIL='amazon_account@email.address'
|
||||||
#LANGUAGE="en-US"
|
SET_PASSWORD='Very_Secret_Amazon_Account_Password'
|
||||||
|
|
||||||
AMAZON='amazon.de'
|
SET_LANGUAGE="de-DE"
|
||||||
#AMAZON='amazon.com'
|
#SET_LANGUAGE="en-US"
|
||||||
|
|
||||||
ALEXA='layla.amazon.de'
|
SET_AMAZON='amazon.de'
|
||||||
#ALEXA='pitangui.amazon.com'
|
#SET_AMAZON='amazon.com'
|
||||||
|
|
||||||
|
SET_ALEXA='alexa.amazon.de'
|
||||||
|
#SET_ALEXA='pitangui.amazon.com'
|
||||||
|
|
||||||
# cURL binary
|
# cURL binary
|
||||||
CURL='/usr/bin/curl'
|
SET_CURL='/usr/bin/curl'
|
||||||
|
|
||||||
# cURL options
|
# cURL options
|
||||||
# -k : if your cURL cannot verify CA certificates, you'll have to trust any
|
# -k : if your cURL cannot verify CA certificates, you'll have to trust any
|
||||||
# --compressed : if your cURL was compiled with libz you may use compression
|
# --compressed : if your cURL was compiled with libz you may use compression
|
||||||
# --http1.1 : cURL defaults to HTTP/2 on HTTPS connections if available
|
# --http1.1 : cURL defaults to HTTP/2 on HTTPS connections if available
|
||||||
OPTS='--compressed --http1.1'
|
SET_OPTS='--compressed --http1.1'
|
||||||
#OPTS='-k --compressed --http1.1'
|
#SET_OPTS='-k --compressed --http1.1'
|
||||||
|
|
||||||
# browser identity
|
# browser identity
|
||||||
BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0'
|
SET_BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:1.0) bash-script/1.0'
|
||||||
|
#SET_BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0'
|
||||||
|
|
||||||
|
# tmp path
|
||||||
|
SET_TMP="/tmp"
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# nothing to configure below here
|
# nothing to configure below here
|
||||||
#
|
#
|
||||||
TMP="/tmp"
|
|
||||||
|
# retrieving environment variables if any are set
|
||||||
|
EMAIL=${EMAIL:-$SET_EMAIL}
|
||||||
|
PASSWORD=${PASSWORD:-$SET_PASSWORD}
|
||||||
|
AMAZON=${AMAZON:-$SET_AMAZON}
|
||||||
|
ALEXA=${ALEXA:-$SET_ALEXA}
|
||||||
|
LANGUAGE=${LANGUAGE:-$SET_LANGUAGE}
|
||||||
|
BROWSER=${BROWSER:-$SET_BROWSER}
|
||||||
|
CURL=${CURL:-$SET_CURL}
|
||||||
|
OPTS=${OPTS:-$SET_OPTS}
|
||||||
|
TMP=${TMP:-$SET_TMP}
|
||||||
|
|
||||||
COOKIE="${TMP}/.alexa.cookie"
|
COOKIE="${TMP}/.alexa.cookie"
|
||||||
DEVLIST="${TMP}/.alexa.devicelist.json"
|
DEVLIST="${TMP}/.alexa.devicelist.json"
|
||||||
DEVTXT="${TMP}/.alexa.devicelist.txt"
|
DEVTXT="${TMP}/.alexa.devicelist.txt"
|
||||||
@ -69,7 +85,7 @@ LASTALEXA=""
|
|||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
echo "$0 [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|vol:<0-100>> |"
|
echo "$0 [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|repeat|vol:<0-100>> |"
|
||||||
echo " -b [list|<\"AA:BB:CC:DD:EE:FF\">] | -q | -r <\"station name\"|stationid> |"
|
echo " -b [list|<\"AA:BB:CC:DD:EE:FF\">] | -q | -r <\"station name\"|stationid> |"
|
||||||
echo " -s <trackID|'Artist' 'Album'> | -t <ASIN> | -u <seedID> | -v <queueID> | -w <playlistId> |"
|
echo " -s <trackID|'Artist' 'Album'> | -t <ASIN> | -u <seedID> | -v <queueID> | -w <playlistId> |"
|
||||||
echo " -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -l | -h"
|
echo " -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -l | -h"
|
||||||
@ -247,6 +263,9 @@ case "$COMMAND" in
|
|||||||
shuffle)
|
shuffle)
|
||||||
COMMAND='{"type":"ShuffleCommand","shuffle":"true"}'
|
COMMAND='{"type":"ShuffleCommand","shuffle":"true"}'
|
||||||
;;
|
;;
|
||||||
|
repeat)
|
||||||
|
COMMAND='{"type":"RepeatCommand","repeat":true}'
|
||||||
|
;;
|
||||||
vol:*)
|
vol:*)
|
||||||
VOL=${COMMAND##*:}
|
VOL=${COMMAND##*:}
|
||||||
# volume as integer!
|
# volume as integer!
|
||||||
|
Loading…
Reference in New Issue
Block a user