shellcheck
correct some warnings
This commit is contained in:
142
soco-cli-gui.sh
142
soco-cli-gui.sh
@@ -55,7 +55,7 @@ dest_yt=$HOME/Music/YouTube
|
|||||||
|
|
||||||
# YouTube (api key and nb results)
|
# YouTube (api key and nb results)
|
||||||
APIKEY="GM_APIKEY"
|
APIKEY="GM_APIKEY"
|
||||||
NORESULTS=5
|
NORESULTS=20
|
||||||
|
|
||||||
fzf_bin=0
|
fzf_bin=0
|
||||||
|
|
||||||
@@ -234,8 +234,9 @@ art() {
|
|||||||
|
|
||||||
# Tracks list from album
|
# Tracks list from album
|
||||||
_tia() {
|
_tia() {
|
||||||
tia=$(sonos "$loc" "$device" tracks_in_album "$1" | tail -n+4 )
|
# suppress all after the first blank line
|
||||||
|
tia=$(sonos "$loc" "$device" tracks_in_album "$1" | tail -n+4 | awk '/^$/{exit} 1')
|
||||||
|
|
||||||
artiste=$(echo "$tia" | head -1 | awk -F":" '{print $3}' | awk -F"|" '{print $1}' | xargs -0)
|
artiste=$(echo "$tia" | head -1 | awk -F":" '{print $3}' | awk -F"|" '{print $1}' | xargs -0)
|
||||||
album=$(echo "$tia" | head -1 | awk -F":" '{print $4}' | awk -F"|" '{print $1}' | xargs -0)
|
album=$(echo "$tia" | head -1 | awk -F":" '{print $4}' | awk -F"|" '{print $1}' | xargs -0)
|
||||||
|
|
||||||
@@ -1110,7 +1111,7 @@ play_local_audio_dir() {
|
|||||||
((i++))
|
((i++))
|
||||||
done <<< "$liste"
|
done <<< "$liste"
|
||||||
echo
|
echo
|
||||||
sonos "$loc" "$device" play_directory "$dir"
|
sonos "$loc" "$device" play_directory "$audio_dir"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1306,7 +1307,8 @@ search_artist_from_library() {
|
|||||||
|
|
||||||
[ "$research" == "q" ] && break
|
[ "$research" == "q" ] && break
|
||||||
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
||||||
art=$(echo "$x" | grep -E ^[[:blank:]]+"$research:")
|
#art=$(echo "$x" | grep -E ^[[:blank:]]+"$research:")
|
||||||
|
art=$(echo "$x" | grep -E "^[[:blank:]]+\"$research:\"")
|
||||||
|
|
||||||
[ -n "$art" ] && break 2
|
[ -n "$art" ] && break 2
|
||||||
fi
|
fi
|
||||||
@@ -1343,7 +1345,8 @@ search_artist_from_library() {
|
|||||||
read -e -p "Choose index of album or (q) to quit: " research
|
read -e -p "Choose index of album or (q) to quit: " research
|
||||||
|
|
||||||
if [ "$research" != "q" ]; then
|
if [ "$research" != "q" ]; then
|
||||||
l_alb=$(echo "$l_alb" | grep -E ^[[:blank:]]+"$research:")
|
#l_alb=$(echo "$l_alb" | grep -E ^[[:blank:]]+"$research:")
|
||||||
|
l_alb=$(echo "$l_alb" | grep -E "^[[:blank:]]+\"$research:\"")
|
||||||
|
|
||||||
[ -n "$l_alb" ] && break
|
[ -n "$l_alb" ] && break
|
||||||
else break
|
else break
|
||||||
@@ -1403,7 +1406,8 @@ search_album_from_library() {
|
|||||||
read -e -p "Choose index of album or (q) to re-search: " research
|
read -e -p "Choose index of album or (q) to re-search: " research
|
||||||
|
|
||||||
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
||||||
alb=$(echo "$x" | grep -E ^[[:blank:]]+"$research:")
|
#alb=$(echo "$x" | grep -E ^[[:blank:]]+"$research:")
|
||||||
|
alb=$(echo "$x" | grep -E "^[[:blank:]]+\"$research:\"")
|
||||||
|
|
||||||
[ -n "$alb" ] && break 2
|
[ -n "$alb" ] && break 2
|
||||||
else break
|
else break
|
||||||
@@ -1425,7 +1429,8 @@ search_album_from_library() {
|
|||||||
|
|
||||||
#list_queue
|
#list_queue
|
||||||
|
|
||||||
w=$(sonos $loc $device queue_album "$album" first : $device play_from_queue) # ajoute en pos 1 et joue
|
#w=$(sonos $loc $device queue_album "$album" first : $device play_from_queue) # ajoute en pos 1 et joue
|
||||||
|
sonos $loc $device queue_album "$album" first : $device play_from_queue > /dev/null # ajoute en pos 1 et joue
|
||||||
_tia "$album"
|
_tia "$album"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1519,11 +1524,13 @@ search_tracks_from_youtube() {
|
|||||||
blocked=$(echo "$details" | jq -r '.contentDetails.regionRestriction.blocked')
|
blocked=$(echo "$details" | jq -r '.contentDetails.regionRestriction.blocked')
|
||||||
#blocked=$(curl --silent "https://www.googleapis.com/youtube/v3/videos?part=contentDetails&fields=items/contentDetails/regionRestriction/blocked&key=$APIKEY&id=$idx" | jq -r '.items[] | .contentDetails.regionRestriction.blocked')
|
#blocked=$(curl --silent "https://www.googleapis.com/youtube/v3/videos?part=contentDetails&fields=items/contentDetails/regionRestriction/blocked&key=$APIKEY&id=$idx" | jq -r '.items[] | .contentDetails.regionRestriction.blocked')
|
||||||
|
|
||||||
|
# If bocked in France => bloc=1
|
||||||
if [ "$blocked" != "null" ]; then
|
if [ "$blocked" != "null" ]; then
|
||||||
blocked=$(echo "$blocked" | jq -r '.[]')
|
blocked=$(echo "$blocked" | jq -r '.[]')
|
||||||
# DE
|
# DE
|
||||||
# RU
|
# RU
|
||||||
[[ $blocked =~ FR ]] && bloc=1
|
[[ $blocked =~ FR ]] && bloc=1
|
||||||
|
# ^--^ SC2034 (warning): bloc appears unused. Verify use (or export if used externally).
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${bold}$j. $title${reset} ($duration)"
|
echo -e "${bold}$j. $title${reset} ($duration)"
|
||||||
@@ -1547,7 +1554,7 @@ search_tracks_from_youtube() {
|
|||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
((j++))
|
((j++))
|
||||||
done <<< $(echo "$result" | jq -c '.')
|
done <<< "$(echo "$result" | jq -c '.')"
|
||||||
|
|
||||||
nb=${#yt_urls[@]}
|
nb=${#yt_urls[@]}
|
||||||
|
|
||||||
@@ -1564,11 +1571,13 @@ search_tracks_from_youtube() {
|
|||||||
youtube_url=${yt_urls[$i]}
|
youtube_url=${yt_urls[$i]}
|
||||||
|
|
||||||
if [ -n "$youtube_url" ]; then
|
if [ -n "$youtube_url" ]; then
|
||||||
|
|
||||||
yt-dlp -f 140 $youtube_url -P $dest_yt -o "%(title)s.%(ext)s" --restrict-filenames
|
yt-dlp -f 140 $youtube_url -P $dest_yt -o "%(title)s.%(ext)s" --restrict-filenames
|
||||||
filename=$(yt-dlp -f 140 $youtube_url -P $dest_yt -o "%(title)s.%(ext)s" --restrict-filenames --get-filename)
|
filename=$(yt-dlp -f 140 $youtube_url -P $dest_yt -o "%(title)s.%(ext)s" --restrict-filenames --get-filename)
|
||||||
|
|
||||||
echo -e "\nPlaying ${bold}$youtube_title${reset} ($youtube_duration) (Ctrl-C to quit)\n"
|
echo -e "\nPlaying ${bold}$youtube_title${reset} ($youtube_duration) (Ctrl-C to quit)\n"
|
||||||
sonos $loc $device play_file "$filename"
|
sonos $loc $device play_file "$filename"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -1613,7 +1622,8 @@ search_tracks_from_library() {
|
|||||||
read -e -p "Choose index of track or (q) to re-search: " research
|
read -e -p "Choose index of track or (q) to re-search: " research
|
||||||
|
|
||||||
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
||||||
trk=$(echo "$tracks" | grep -E ^[[:blank:]]+"$research:")
|
#trk=$(echo "$tracks" | grep -E ^[[:blank:]]+"$research:")
|
||||||
|
trk=$(echo "$tracks" | grep -E "^[[:blank:]]+\"$research:\"")
|
||||||
[ -n "$trk" ] && break 2 || echo "Wrong Choice !"
|
[ -n "$trk" ] && break 2 || echo "Wrong Choice !"
|
||||||
|
|
||||||
else break
|
else break
|
||||||
@@ -1648,10 +1658,10 @@ play_uri() {
|
|||||||
echo -e "\n${bold} Play radio stream... ${reset}\n"
|
echo -e "\n${bold} Play radio stream... ${reset}\n"
|
||||||
|
|
||||||
if [ $fzf_bin -eq 1 ]; then
|
if [ $fzf_bin -eq 1 ]; then
|
||||||
header=" ESC to quit !"
|
header=" ESC to quit ! (enter stream manually)"
|
||||||
prompt="Choose a radio: "
|
prompt="Choose a radio: "
|
||||||
|
|
||||||
unset radio_uri[*CHIME*]
|
unset "radio_uri[*CHIME*]"
|
||||||
choice=$(printf "Play %s\n" "${!radio_uri[@]}" | sort | fzf "${fzf_args[@]}" --prompt "$prompt" --header "$header")
|
choice=$(printf "Play %s\n" "${!radio_uri[@]}" | sort | fzf "${fzf_args[@]}" --prompt "$prompt" --header "$header")
|
||||||
[ -n "$choice" ] && uri_fzf=${radio_uri[${choice:5}]}
|
[ -n "$choice" ] && uri_fzf=${radio_uri[${choice:5}]}
|
||||||
url="$uri_fzf"
|
url="$uri_fzf"
|
||||||
@@ -1661,38 +1671,42 @@ play_uri() {
|
|||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
|
|
||||||
read -e -p "Enter radio stream URL [.mp3|.aac|.m3u|.pls]: " -i "http://" url
|
read -e -p "Enter radio stream URL [.mp3|.aac|.m3u|.pls] or Q to quit !: " -i "http://" enter
|
||||||
#url="http://jazzradio.ice.infomaniak.ch/jazzradio-high.aac"
|
#url="http://jazzradio.ice.infomaniak.ch/jazzradio-high.aac"
|
||||||
|
[[ "$enter" =~ ^[qQ] ]] && break
|
||||||
|
|
||||||
read -p "Enter radio stream name: " title
|
read -p "Enter radio stream name: " title
|
||||||
|
|
||||||
REGEX="CHIME|^(https?|ftp|file)://[-[:alnum:]\+&@#/%?=~_|!:,.;]+"
|
REGEX="CHIME|^(https?|ftp|file)://[-[:alnum:]\+&@#/%?=~_|!:,.;]+"
|
||||||
if [[ "$url" =~ $REGEX ]]; then break
|
if [[ "$enter" =~ $REGEX ]]; then
|
||||||
|
url="$enter"
|
||||||
|
break
|
||||||
else echo -e "\nWrong radio stream URL !"
|
else echo -e "\nWrong radio stream URL !"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get title from url in radio_uri array
|
if [ -n "$url" ]; then
|
||||||
for k in "${!radio_uri[@]}"; do
|
# Get title from url in radio_uri array
|
||||||
[[ ${radio_uri[$k]} == $url ]] && title="$k"
|
for k in "${!radio_uri[@]}"; do
|
||||||
done
|
[[ ${radio_uri[$k]} == "$url" ]] && title="$k"
|
||||||
|
done
|
||||||
|
|
||||||
# get url status ans radio's name
|
# get url status ans radio's name
|
||||||
_curl_url ${url}
|
_curl_url ${url}
|
||||||
|
|
||||||
# valid radio stream
|
# valid radio stream
|
||||||
if [ $status_uri -eq 200 ]; then
|
if [ $status_uri -eq 200 ]; then
|
||||||
_display_cover_art $url
|
_display_cover_art $url
|
||||||
if [ -n "$title" ]; then playing="Playing ${title} radio stream..."
|
if [ -n "$title" ]; then playing="Playing ${title} radio stream..."
|
||||||
elif [ -n "$icy_name" ]; then playing="Playing ${icy_name} radio stream..."
|
elif [ -n "$icy_name" ]; then playing="Playing ${icy_name} radio stream..."
|
||||||
else playing="Playing $url radio stream..."
|
else playing="Playing $url radio stream..."
|
||||||
fi
|
fi
|
||||||
echo -e "\n${bold} $playing ${reset}"
|
echo -e "\n${bold} $playing ${reset}"
|
||||||
sonos "$loc" "$device" play_uri $url "$title"
|
sonos "$loc" "$device" play_uri $url "$title"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
sleep 2
|
sleep 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sleep timer
|
# Sleep timer
|
||||||
@@ -2013,7 +2027,8 @@ favourite_radio_stations() {
|
|||||||
[ "$choose" == "q" ] && break;
|
[ "$choose" == "q" ] && break;
|
||||||
if [ "$choose" != "q" ] && [ -n "$choose" ]; then
|
if [ "$choose" != "q" ] && [ -n "$choose" ]; then
|
||||||
if _is_int "$choose"; then
|
if _is_int "$choose"; then
|
||||||
rad=$(echo "$r" | grep -E ^[[:blank:]]+"$choose:")
|
#rad=$(echo "$r" | grep -E ^[[:blank:]]+"$choose:")
|
||||||
|
rad=$(echo "$r" | grep -E "^[[:blank:]]+\"$choose:\"")
|
||||||
[ -n "$rad" ] && break
|
[ -n "$rad" ] && break
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -2061,7 +2076,8 @@ list_favs() {
|
|||||||
[ "$choose" == "q" ] && break;
|
[ "$choose" == "q" ] && break;
|
||||||
if [ "$choose" != "q" ] && [ -n "$choose" ]; then
|
if [ "$choose" != "q" ] && [ -n "$choose" ]; then
|
||||||
if _is_int "$choose"; then
|
if _is_int "$choose"; then
|
||||||
fav=$(echo "$f" | grep -E ^[[:blank:]]+"$choose:")
|
#fav=$(echo "$f" | grep -E ^[[:blank:]]+"$choose:")
|
||||||
|
fav=$(echo "$f" | grep -E "^[[:blank:]]+\"$choose:\"")
|
||||||
[ -n "$fav" ] && break
|
[ -n "$fav" ] && break
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -2087,9 +2103,7 @@ list_favs() {
|
|||||||
list_queue() {
|
list_queue() {
|
||||||
echo -e "\n${bold} Queue... ${reset}"
|
echo -e "\n${bold} Queue... ${reset}"
|
||||||
q=$(sonos "$loc" "$device" list_queue)
|
q=$(sonos "$loc" "$device" list_queue)
|
||||||
#q=$(echo "$q" | head -n75)
|
|
||||||
#echo -e "\n $q \n"
|
|
||||||
fzf_bin=0
|
|
||||||
if [ $fzf_bin -eq 1 ]; then
|
if [ $fzf_bin -eq 1 ]; then
|
||||||
|
|
||||||
fzf_queue_args=(
|
fzf_queue_args=(
|
||||||
@@ -2103,10 +2117,8 @@ list_queue() {
|
|||||||
t=$(echo "$q" | awk NF | fzf "${fzf_queue_args[@]}")
|
t=$(echo "$q" | awk NF | fzf "${fzf_queue_args[@]}")
|
||||||
|
|
||||||
else
|
else
|
||||||
#q=$(echo "$q" | more)
|
|
||||||
echo -e "\nList of tracks in queue: (using <more>)"
|
echo -e "\nList of tracks in queue: (using <more>)"
|
||||||
echo -e "$q \n" | more
|
echo -e "$q \n" | more -d
|
||||||
#read -p "< Press Enter>"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2171,11 +2183,6 @@ clear_queue() {
|
|||||||
play_queue() {
|
play_queue() {
|
||||||
echo -e "\n${bold} Play queue... ${reset}"
|
echo -e "\n${bold} Play queue... ${reset}"
|
||||||
q=$(sonos "$loc" "$device" list_queue)
|
q=$(sonos "$loc" "$device" list_queue)
|
||||||
#q=$(cat queue.txt | tail -n +2 )
|
|
||||||
|
|
||||||
#q_length=$(sonos "$loc" "$device" queue_length)
|
|
||||||
|
|
||||||
fzf_bin=0
|
|
||||||
|
|
||||||
if [ -n "$q" ]; then
|
if [ -n "$q" ]; then
|
||||||
|
|
||||||
@@ -2183,18 +2190,19 @@ play_queue() {
|
|||||||
|
|
||||||
q=$(echo -e "last_added: last_added\n random: random\n last: last\n current: current\n$q")
|
q=$(echo -e "last_added: last_added\n random: random\n last: last\n current: current\n$q")
|
||||||
|
|
||||||
fzf_music_folder_args=(
|
fzf_queue_args=(
|
||||||
--border
|
--border
|
||||||
--exact
|
--exact
|
||||||
|
--height 60%
|
||||||
--header="ENTER for select track; ESC for a new search"
|
--header="ENTER for select track; ESC for a new search"
|
||||||
--prompt="Choose index of queue file: "
|
--prompt="Choose index of queue file: "
|
||||||
)
|
)
|
||||||
queue=$(echo "$q" | fzf "${fzf_music_folder_args[@]}")
|
queue=$(echo "$q" | awk NF | fzf "${fzf_queue_args[@]}")
|
||||||
pos_queue=$(echo "$queue" | awk -F":" '{print $1}')
|
pos_queue=$(echo "$queue" | awk -F":" '{print $1}')
|
||||||
|
|
||||||
else
|
else
|
||||||
#q=$(echo "$q" | head -n75)
|
echo -e "\nList of tracks in queue: (using <more>)"
|
||||||
echo -e "\n $q \n"
|
echo -e "\n $q \n" | more -d
|
||||||
|
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
@@ -2211,7 +2219,8 @@ play_queue() {
|
|||||||
[ "$research" == "l" ] && pos_queue="last" && break
|
[ "$research" == "l" ] && pos_queue="last" && break
|
||||||
[ "$research" == "r" ] && pos_queue="random" && break
|
[ "$research" == "r" ] && pos_queue="random" && break
|
||||||
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
||||||
queue=$(echo "$q" | grep -E ^[[:blank:]]+"$research:")
|
#queue=$(echo "$q" | grep -E ^[[:blank:]]+"$research:")
|
||||||
|
queue=$(echo "$q" | grep -E "^[[:blank:]]+\"$research:\"")
|
||||||
pos_queue=$(echo "$queue" | awk -F":" '{print $1}')
|
pos_queue=$(echo "$queue" | awk -F":" '{print $1}')
|
||||||
[ -n "$queue" ] && break
|
[ -n "$queue" ] && break
|
||||||
else break
|
else break
|
||||||
@@ -2220,14 +2229,23 @@ play_queue() {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$queue"
|
if [ -n "$queue" ] && [ -n "$pos_queue" ]; then
|
||||||
echo "$pos_queue"
|
artist=$(echo "$queue" | awk -F ": " '{print $3}' | awk -F "|" '{print $1}' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')
|
||||||
|
album=$(echo "$queue" | awk -F ": " '{print $4}' | awk -F "|" '{print $1}' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')
|
||||||
|
title=$(echo "$queue" | awk -F ": " '{print $5}' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')
|
||||||
|
|
||||||
# sonos "$loc" "$device" play_from_queue "$pos_queue"
|
echo -e "\nPlaying ${bold}$title${reset} from album ${bold}$album${reset} of ${bold}$artist${reset}..."
|
||||||
|
|
||||||
|
|
||||||
|
sonos "$loc" "$device" play_from_queue "$pos_queue"
|
||||||
|
art
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Queue is empty !"
|
echo "Queue is empty !"
|
||||||
fi
|
fi
|
||||||
read -p "< Press Enter>"
|
|
||||||
|
sleep 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
# List Artists
|
# List Artists
|
||||||
@@ -2525,8 +2543,8 @@ remove_alarms() {
|
|||||||
h=$(echo "$trk" | sed 's/,/ /g')
|
h=$(echo "$trk" | sed 's/,/ /g')
|
||||||
for i in ${h}
|
for i in ${h}
|
||||||
do
|
do
|
||||||
[[ $ala_id =~ "$i" ]] && j+="$i,"
|
[[ $ala_id =~ $i ]] && j+="$i,"
|
||||||
[[ ! $ala_id =~ "$i" ]] && k+="$i,"
|
[[ ! $ala_id =~ $i ]] && k+="$i,"
|
||||||
done
|
done
|
||||||
j=$(echo "$j" | sed 's/,$//')
|
j=$(echo "$j" | sed 's/,$//')
|
||||||
k=$(echo "$k" | sed 's/,$//')
|
k=$(echo "$k" | sed 's/,$//')
|
||||||
@@ -2616,10 +2634,11 @@ move_alarms() {
|
|||||||
|
|
||||||
actual_speaker=$(echo "$long_ala" | awk -F "|" -v var="$trk" '($2 == var) {print $3}' | xargs | sed 's/ , /,/g')
|
actual_speaker=$(echo "$long_ala" | awk -F "|" -v var="$trk" '($2 == var) {print $3}' | xargs | sed 's/ , /,/g')
|
||||||
other_speakers=$(echo "$dev" | grep -v $actual_speaker | cut -d ' ' -f1)
|
other_speakers=$(echo "$dev" | grep -v $actual_speaker | cut -d ' ' -f1)
|
||||||
other="${other_speakers[@]}"
|
#other="${other_speakers[@]}"
|
||||||
|
other="${other_speakers[*]}"
|
||||||
|
|
||||||
read -e -p "Move Alarm ID <$trk> to Speaker <$other> (enter target name): " -i ${other_speakers[0]} target
|
read -e -p "Move Alarm ID <$trk> to Speaker <$other> (enter target name): " -i ${other_speakers[0]} target
|
||||||
if [[ $other_speakers =~ "$target" ]]; then
|
if [[ $other_speakers =~ $target ]]; then
|
||||||
sonos $loc $target move_alarm $trk
|
sonos $loc $target move_alarm $trk
|
||||||
[ $? != 0 ] && echo -e "${red}Error !${reset}"
|
[ $? != 0 ] && echo -e "${red}Error !${reset}"
|
||||||
break
|
break
|
||||||
@@ -2652,7 +2671,8 @@ copy_alarms() {
|
|||||||
|
|
||||||
actual_speaker=$(echo "$long_ala" | awk -F "|" -v var="$trk" '($2 == var) {print $3}' | xargs | sed 's/ , /,/g')
|
actual_speaker=$(echo "$long_ala" | awk -F "|" -v var="$trk" '($2 == var) {print $3}' | xargs | sed 's/ , /,/g')
|
||||||
other_speakers=$(echo "$dev" | grep -v $actual_speaker | cut -d ' ' -f1)
|
other_speakers=$(echo "$dev" | grep -v $actual_speaker | cut -d ' ' -f1)
|
||||||
other="${other_speakers[@]}"
|
#other="${other_speakers[@]}"
|
||||||
|
other="${other_speakers[*]}"
|
||||||
|
|
||||||
if [ $fzf_bin -eq 1 ]; then
|
if [ $fzf_bin -eq 1 ]; then
|
||||||
header=" Choose a target speaker for this alarm"
|
header=" Choose a target speaker for this alarm"
|
||||||
@@ -2665,7 +2685,7 @@ copy_alarms() {
|
|||||||
[ -z "$other_speaker_fzf" ] && other_speaker_fzf="$other"
|
[ -z "$other_speaker_fzf" ] && other_speaker_fzf="$other"
|
||||||
|
|
||||||
read -e -p "Copy Alarm ID <$trk> to Speaker <$other> (enter target name): " -i "$other_speaker_fzf" target
|
read -e -p "Copy Alarm ID <$trk> to Speaker <$other> (enter target name): " -i "$other_speaker_fzf" target
|
||||||
if [[ $other_speakers =~ "$target" ]]; then
|
if [[ $other_speakers =~ $target ]]; then
|
||||||
sonos $loc $target copy_alarm $trk
|
sonos $loc $target copy_alarm $trk
|
||||||
[ $? != 0 ] && echo -e "${red}Error !${reset}"
|
[ $? != 0 ] && echo -e "${red}Error !${reset}"
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user