bugfix
in functions art(), _tia(), search_artist_from_library(), search_album_from_library() remove functions play_album_from_library() and play_artist_from_library()
This commit is contained in:
215
soco-cli-gui.sh
215
soco-cli-gui.sh
@@ -197,19 +197,19 @@ _display_cover_art() {
|
|||||||
|
|
||||||
# Display cover art of current
|
# Display cover art of current
|
||||||
art() {
|
art() {
|
||||||
art=$(sonos $loc $device album_art)
|
art=$(sonos $loc $device album_art 2>/dev/null)
|
||||||
|
if [ -n "$art" ]; then
|
||||||
_display_cover_art $art
|
_display_cover_art $art
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tracks list from album
|
# Tracks list from album
|
||||||
_tia() {
|
_tia() {
|
||||||
tia=$(sonos $loc $device tracks_in_album "$1" | tail -n+4 )
|
tia=$(sonos $loc $device tracks_in_album "$1" | tail -n+4 )
|
||||||
|
|
||||||
artiste=$(echo "$tia" | head -1 | awk -F":" '{print $3}' | awk -F"|" '{print $1}' | xargs)
|
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)
|
album=$(echo "$tia" | head -1 | awk -F":" '{print $4}' | awk -F"|" '{print $1}' | xargs -0)
|
||||||
|
|
||||||
#echo -e "\n\t${bold}$album${reset} from ${bold}$artiste${reset}..."
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
@@ -1239,7 +1239,6 @@ make_playlist() {
|
|||||||
search_artist_from_library() {
|
search_artist_from_library() {
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
fzf_bin=0
|
fzf_bin=0
|
||||||
if [ $fzf_bin -eq 1 ]; then
|
if [ $fzf_bin -eq 1 ]; then
|
||||||
|
|
||||||
@@ -1248,39 +1247,42 @@ search_artist_from_library() {
|
|||||||
--exact
|
--exact
|
||||||
)
|
)
|
||||||
|
|
||||||
#art=$(soco $loc $device list_artists | tail -n+4 | fzf "${fzf_music_folder_args[@]}")
|
art=$(sonos $loc $device list_artists | tail -n+4 | fzf "${fzf_music_folder_args[@]}")
|
||||||
art=$(cat list_artists.txt | tail -n+4 | fzf "${fzf_music_folder_args[@]}")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$art"
|
||||||
|
|
||||||
if [ -z "$art" ]; then
|
if [ -z "$art" ]; then
|
||||||
#art=$(soco $loc $device list_artists | tail -n+4)
|
art=$(sonos $loc $device list_artists | tail -n+4)
|
||||||
art=$(cat list_artists.txt | tail -n+4)
|
|
||||||
|
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
read -e -p "Search artist in library: " search
|
read -e -p "Search artist in library: " search
|
||||||
|
|
||||||
x=$(echo "$art" | grep -i $search)
|
if [ -n "$search" ]; then
|
||||||
echo -e "$x\n"
|
x=$(echo "$art" | grep -i $search)
|
||||||
|
echo -e "$x\n"
|
||||||
|
fi
|
||||||
|
|
||||||
while :
|
if [ -n "$x" ]; then
|
||||||
do
|
while :
|
||||||
|
do
|
||||||
|
read -e -p "Choose index of artist or q to re-search: " research
|
||||||
|
|
||||||
read -e -p "Choose index of artist or q to re-search: " research
|
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
||||||
|
art=$(echo "$x" | grep -E ^[[:blank:]]+"$research:")
|
||||||
|
|
||||||
if [ $research != "q" ]; then
|
[ -n "$art" ] && break 2
|
||||||
art=$(echo "$x" | grep -E ^[[:blank:]]+"$research:")
|
else break
|
||||||
#echo "$art"
|
fi
|
||||||
|
done
|
||||||
[ -n "$art" ] && break 2
|
fi
|
||||||
else break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
artiste=$(echo "$art" | awk -F":" '{print $2}' | xargs)
|
|
||||||
index=$(echo "$art" | awk -F":" '{print $1}' | xargs)
|
artiste=$(echo "$art" | awk -F":" '{print $2}' | xargs -0)
|
||||||
|
#index=$(echo "$art" | awk -F":" '{print $1}' | xargs)
|
||||||
|
|
||||||
if [ $fzf_bin -eq 1 ]; then
|
if [ $fzf_bin -eq 1 ]; then
|
||||||
|
|
||||||
@@ -1289,48 +1291,51 @@ search_artist_from_library() {
|
|||||||
--exact
|
--exact
|
||||||
)
|
)
|
||||||
|
|
||||||
#art=$(soco $loc $device list_albums | tail -n+4 | fzf "${fzf_music_folder_args[@]}")
|
l_alb=$(sonos $loc $device list_albums | tail -n+4 | grep -i "$artiste" | fzf "${fzf_music_folder_args[@]}")
|
||||||
alb=$(cat list_albums.txt | tail -n+4 | grep -i "$artiste" | fzf "${fzf_music_folder_args[@]}")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$alb" ]; then
|
if [ -z "$l_alb" ]; then
|
||||||
#art=$(soco $loc $device list_artists | tail -n+4)
|
l_alb=$(sonos $loc $device list_albums | tail -n+4 | grep -i "$artiste")
|
||||||
alb=$(cat list_albums.txt | tail -n+4 | grep -i "$artiste")
|
#fi
|
||||||
|
echo -e "\n${underline}Albums from $artiste:${reset}"
|
||||||
|
echo -e "$l_alb\n"
|
||||||
|
if [ -n "$l_alb" ]; then
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
read -e -p "Choose index of album or (q) to quit: " research
|
||||||
|
|
||||||
fi
|
if [ "$research" != "q" ]; then
|
||||||
echo -e "\n${underline}Albums from $artiste:${reset}"
|
alb=$(echo "$l_alb" | grep -E ^[[:blank:]]+"$research:")
|
||||||
echo "$alb"
|
|
||||||
|
|
||||||
while :
|
[ -n "$alb" ] && break
|
||||||
do
|
else break
|
||||||
read -e -p "Choose index of album or q to re-search: " research
|
fi
|
||||||
|
done
|
||||||
if [ $research != "q" ]; then
|
else echo -e "No albums from ${bold}$artiste${reset} found !"
|
||||||
alb=$(echo "$alb" | grep -E ^[[:blank:]]+"$research:")
|
|
||||||
|
|
||||||
[ -n "$alb" ] && break
|
|
||||||
else break
|
|
||||||
fi
|
fi
|
||||||
done
|
else
|
||||||
|
alb="$l_alb"
|
||||||
|
fi
|
||||||
|
|
||||||
artiste=$(echo "$alb" | awk -F":" '{print $4}' | awk -F"|" '{print $1}' | xargs)
|
if [ -n "$alb" ]; then
|
||||||
album=$(echo "$alb" | awk -F":" '{print $3}' | awk -F"|" '{print $1}' | xargs)
|
artiste=$(echo "$alb" | awk -F":" '{print $4}' | awk -F"|" '{print $1}' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')
|
||||||
index=$(echo "$alb" | awk -F":" '{print $1}' | xargs)
|
album=$(echo "$alb" | awk -F":" '{print $3}' | awk -F"|" '{print $1}' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//') # xargs: unterminated quote
|
||||||
|
#index=$(echo "$alb" | awk -F":" '{print $1}' | xargs)
|
||||||
|
|
||||||
echo -e "\nAdding ${bold}$album${reset} from ${bold}$artiste${reset} to queue and playing..."
|
echo -e "\nAdding ${bold}$album${reset} from ${bold}$artiste${reset} to queue and playing..."
|
||||||
|
|
||||||
#list_queue
|
#list_queue
|
||||||
|
|
||||||
w=$(sonos $loc $device queue_album "$album" first : $device play_from_queue) # ajoute en pos 1 et joue
|
|
||||||
_tia "$album"
|
|
||||||
|
|
||||||
|
w=$(sonos $loc $device queue_album "$album" first : $device play_from_queue) # ajoute en pos 1 et joue
|
||||||
|
_tia "$album"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
search_album_from_library() {
|
search_album_from_library() {
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
fzf_bin=0
|
#fzf_bin=0
|
||||||
if [ $fzf_bin -eq 1 ]; then
|
if [ $fzf_bin -eq 1 ]; then
|
||||||
|
|
||||||
fzf_music_folder_args=(
|
fzf_music_folder_args=(
|
||||||
@@ -1350,21 +1355,27 @@ search_album_from_library() {
|
|||||||
do
|
do
|
||||||
read -e -p "Search album in library: " search
|
read -e -p "Search album in library: " search
|
||||||
|
|
||||||
x=$(echo "$alb" | grep -i $search)
|
if [ -n "$search" ]; then
|
||||||
echo -e "$x\n"
|
x=$(echo "$alb" | grep -i $search)
|
||||||
|
echo -e "$x\n"
|
||||||
|
fi
|
||||||
|
|
||||||
while :
|
if [ -n "$x" ]; then
|
||||||
do
|
|
||||||
|
|
||||||
read -e -p "Choose index of album or q to re-search: " research
|
while :
|
||||||
|
do
|
||||||
|
|
||||||
if [ $research != "q" ]; then
|
read -e -p "Choose index of album or (q) to re-search: " research
|
||||||
alb=$(echo "$x" | grep -E ^[[:blank:]]+"$research:")
|
|
||||||
|
|
||||||
[ -n "$alb" ] && break 2
|
if [ "$research" != "q" ] && [ -n "$research" ]; then
|
||||||
else break
|
alb=$(echo "$x" | grep -E ^[[:blank:]]+"$research:")
|
||||||
fi
|
|
||||||
done
|
[ -n "$alb" ] && break 2
|
||||||
|
else break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else echo -e "No albums ${bold}$search${reset} found !"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1373,9 +1384,23 @@ search_album_from_library() {
|
|||||||
#sonos $loc $device clear_queue : $device queue_album "$album" : $device play_from_queue > /dev/null
|
#sonos $loc $device clear_queue : $device queue_album "$album" : $device play_from_queue > /dev/null
|
||||||
#sonos $device queue_album "$album" next : $device play_from_queue # ajoute en pos 2 et joue
|
#sonos $device queue_album "$album" next : $device play_from_queue # ajoute en pos 2 et joue
|
||||||
|
|
||||||
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 # ajoute en pos 1 et joue
|
||||||
|
|
||||||
|
#sonos $loc $device list_queue
|
||||||
|
|
||||||
|
if [ -n "$alb" ]; then
|
||||||
|
artiste=$(echo "$alb" | awk -F":" '{print $4}' | awk -F"|" '{print $1}' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')
|
||||||
|
album=$(echo "$alb" | awk -F":" '{print $3}' | awk -F"|" '{print $1}' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//') # xargs: unterminated quote
|
||||||
|
#index=$(echo "$alb" | awk -F":" '{print $1}' | xargs)
|
||||||
|
|
||||||
|
echo -e "\nAdding ${bold}$album${reset} from ${bold}$artiste${reset} to queue and playing..."
|
||||||
|
|
||||||
|
#list_queue
|
||||||
|
|
||||||
|
w=$(sonos $loc $device queue_album "$album" first : $device play_from_queue) # ajoute en pos 1 et joue
|
||||||
|
_tia "$album"
|
||||||
|
fi
|
||||||
|
|
||||||
sonos $loc $device list_queue
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1389,63 +1414,6 @@ in_progress() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Search artist in library -> add album to queue -> play it
|
|
||||||
play_artist_from_library() {
|
|
||||||
read -e -p "Search artist in library: " search
|
|
||||||
|
|
||||||
if [ -n "$search" ]; then
|
|
||||||
a=$(sonos $loc $device search_artists "$search")
|
|
||||||
|
|
||||||
# fzf
|
|
||||||
|
|
||||||
if [ -n "$a" ]; then
|
|
||||||
echo -e "$a\n"
|
|
||||||
read -e -p "Album to play (n°): " number
|
|
||||||
|
|
||||||
if [[ "$number" =~ ^[+-]?[0-9]+$ ]]; then
|
|
||||||
b=$(echo "$a" | grep -m 1 "$number: ")
|
|
||||||
album=$(echo "$b" | awk -F ": " '{print $3}' | awk -F "|" '{print $1}' | sed 's/ *$//g')
|
|
||||||
artist=$(echo "$b" | awk -F ": " '{print $4}')
|
|
||||||
|
|
||||||
playing="Playing $album from $artist..."
|
|
||||||
echo -e "\n${bold} $playing ${reset}"
|
|
||||||
|
|
||||||
sonos $loc $device queue_search_result_number $number first : $device play_from_queue > /dev/null
|
|
||||||
else echo "Please, enter the number of the album to play !"
|
|
||||||
fi
|
|
||||||
else echo -e "Artist ${underline}$search${reset} was not found !"
|
|
||||||
fi
|
|
||||||
else echo "Empty query !"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Search album in library -> add to queue -> play it
|
|
||||||
play_album_from_library() {
|
|
||||||
read -e -p "Search album in library: " search
|
|
||||||
|
|
||||||
if [ -n "$search" ]; then
|
|
||||||
a=$(sonos $loc $device search_albums "$search")
|
|
||||||
if [ -n "$a" ]; then
|
|
||||||
echo -e "$a\n"
|
|
||||||
read -e -p "Album to play (n°): " number
|
|
||||||
|
|
||||||
if [[ "$number" =~ ^[+-]?[0-9]+$ ]]; then
|
|
||||||
b=$(echo "$a" | grep -m 1 "$number: ")
|
|
||||||
album=$(echo "$b" | awk -F ": " '{print $3}' | awk -F "|" '{print $1}' | sed 's/ *$//g')
|
|
||||||
artist=$(echo "$b" | awk -F ": " '{print $4}')
|
|
||||||
|
|
||||||
playing="Playing $album from $artist..."
|
|
||||||
echo -e "\n${bold} $playing ${reset}"
|
|
||||||
|
|
||||||
sonos $loc $device queue_search_result_number $number first : $device play_from_queue > /dev/null
|
|
||||||
else echo "Please, enter the number of the album to play !"
|
|
||||||
fi
|
|
||||||
else echo -e "Album ${underline}$search${reset} was not found !"
|
|
||||||
fi
|
|
||||||
else echo "Empty query !"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Search track in library -> add to queue -> play it
|
# Search track in library -> add to queue -> play it
|
||||||
play_track_from_library() {
|
play_track_from_library() {
|
||||||
read -e -p "Search track in library: " search
|
read -e -p "Search track in library: " search
|
||||||
@@ -1836,6 +1804,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"
|
echo -e "\n $q \n"
|
||||||
read -p "< Press Enter>"
|
read -p "< Press Enter>"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user