sonos.sh
Features: +ALL status light
This commit is contained in:
76
sonos.sh
76
sonos.sh
@@ -47,7 +47,7 @@ main() {
|
|||||||
echo -e " 2) ${bgd}H${reset}elp "
|
echo -e " 2) ${bgd}H${reset}elp "
|
||||||
echo -e " 3) ➔ ${bgd}C${reset}hambre "
|
echo -e " 3) ➔ ${bgd}C${reset}hambre "
|
||||||
echo -e " 4) ➔ ${bgd}S${reset}alon "
|
echo -e " 4) ➔ ${bgd}S${reset}alon "
|
||||||
echo -e " 5) ➔ A${bgd}l${reset}l "
|
echo -e " 5) ➔ A${bgd}l${reset}l devices "
|
||||||
echo -e " 6) ${bgd}Q${reset}uit "
|
echo -e " 6) ${bgd}Q${reset}uit "
|
||||||
echo -e "================================="
|
echo -e "================================="
|
||||||
echo -e "Enter your menu choice [1-6]: \c "
|
echo -e "Enter your menu choice [1-6]: \c "
|
||||||
@@ -574,19 +574,16 @@ led() {
|
|||||||
led=$(sonos $loc $device status_light)
|
led=$(sonos $loc $device status_light)
|
||||||
echo -e "Status light is ${bold}$led${reset}"
|
echo -e "Status light is ${bold}$led${reset}"
|
||||||
|
|
||||||
if [[ "$led" == "on" ]]; then
|
if [[ "$led" == "on" ]]; then
|
||||||
|
|
||||||
echo -e "${italic} ...Switching status light off${reset}"
|
echo -e "${italic} ...Switching status light off${reset}"
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
sonos $loc $device status_light off
|
sonos $loc $device status_light off
|
||||||
status="OFF"
|
status="OFF"
|
||||||
#echo -e "Status light is ${bold}off${reset}"
|
|
||||||
elif [[ "$led" == "off" ]]; then
|
elif [[ "$led" == "off" ]]; then
|
||||||
echo -e "${italic} ...Switching status light on${reset}"
|
echo -e "${italic} ...Switching status light on${reset}"
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
sonos $loc $device status_light on
|
sonos $loc $device status_light on
|
||||||
status="ON"
|
status="ON"
|
||||||
#echo -e "Status light is ${bold}on${reset}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "Status light is ${bold}$status${reset}"
|
echo -e "Status light is ${bold}$status${reset}"
|
||||||
@@ -873,5 +870,74 @@ info_5() {
|
|||||||
read -p "< Press Enter>"
|
read -p "< Press Enter>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
all() {
|
||||||
|
clear
|
||||||
|
cde=""
|
||||||
|
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
clear
|
||||||
|
echo -e ""
|
||||||
|
echo -e "\033[1m 🔊 Sonos All devices \033[0m"
|
||||||
|
echo -e ""
|
||||||
|
echo -e "Below commands apply to all Sonos devices in the network."
|
||||||
|
echo -e ""
|
||||||
|
echo -e "-------------------------------------"
|
||||||
|
echo -e " Sonos All devices "
|
||||||
|
echo -e " $cde "
|
||||||
|
echo -e "-------------------------------------"
|
||||||
|
echo -e " 1) S${bgd}w${reset}itch Status Light OFF " " | "
|
||||||
|
echo -e " 2) ${bgd}S${reset}witch Status Light ON " " | "
|
||||||
|
echo -e " 3) " " | "
|
||||||
|
echo -e " 4) " " | "
|
||||||
|
echo -e " 5) " " | "
|
||||||
|
echo -e " 6) " " | "
|
||||||
|
echo -e " 7) " " | "
|
||||||
|
echo -e " 8) " " | "
|
||||||
|
echo -e " 9) " " | "
|
||||||
|
echo -e "10) ${bgd}R${reset}eturn " " | "
|
||||||
|
echo -e "====================================="
|
||||||
|
echo -e "Enter your menu choice [1-10]: \c "
|
||||||
|
read infos
|
||||||
|
|
||||||
|
case "$infos" in
|
||||||
|
|
||||||
|
1|w|W) all_1;;
|
||||||
|
2|s|S) all_2;;
|
||||||
|
3|i|I) all_3;;
|
||||||
|
4|s|S) all_4;;
|
||||||
|
5|y|Y) all_5;;
|
||||||
|
10|r|R) exec "$0";;
|
||||||
|
*) echo -e "\n${red}Oops!!! Please Select Correct Choice${reset}";
|
||||||
|
echo -e "Press ${bold}ENTER${reset} To Continue..." ; read ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Switch OFF status light
|
||||||
|
all_1() {
|
||||||
|
cde="Switch OFF status light on All devices..."
|
||||||
|
echo -e "\n\033[1m $cde \033[0m"
|
||||||
|
|
||||||
|
sleep 0.5
|
||||||
|
saslof=$(sonos _all_ status_light off | tr '\n' ' ' | xargs)
|
||||||
|
|
||||||
|
cde="Status light is ${bold}OFF${reset} on $saslof devices"
|
||||||
|
echo -e "Status light is ${bold}OFF${reset} on ALL devices"
|
||||||
|
sleep 1.5
|
||||||
|
}
|
||||||
|
|
||||||
|
# Switch ON status light
|
||||||
|
all_2() {
|
||||||
|
cde="Switch ON status light on All devices..."
|
||||||
|
echo -e "\n\033[1m $cde \033[0m"
|
||||||
|
|
||||||
|
sleep 0.5
|
||||||
|
saslon=$(sonos _all_ status_light on | tr '\n' ' ' | xargs)
|
||||||
|
|
||||||
|
cde="Status light is ${bold}ON${reset} on $saslon devices"
|
||||||
|
echo -e "Status light is ${bold}ON${reset} on ALL devices"
|
||||||
|
sleep 1.5
|
||||||
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|||||||
Reference in New Issue
Block a user