From 4dd8279d35eaa19fdaf1a50f9facd5713238408d Mon Sep 17 00:00:00 2001 From: Bruno 21 Date: Thu, 24 Dec 2020 07:10:16 +0100 Subject: [PATCH] sonos.sh Feature: +remove a track from playlist --- sonos.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sonos.sh b/sonos.sh index 34e079e..7caccb6 100755 --- a/sonos.sh +++ b/sonos.sh @@ -526,7 +526,7 @@ soco_lists() { echo -e " 3) ${bgd}Q${reset}ueue " " | " " 13) D${bgd}e${reset}lete playlists " " | " echo -e " 4) List ${bgd}a${reset}rtists " " | " " 14) ${bgd}L${reset}ists tracks in all Sonos Playlists " " | " echo -e " 5) List al${bgd}b${reset}ums " " | " " 15) Ad${bgd}d${reset} a Sonos playlist to queue " " | " - echo -e " 6) " " | " " 16) " " | " + echo -e " 6) " " | " " 16) Remove a trac${bgd}k${reset} from a Sonos playlist " " | " echo -e " 7) " " | " " 17) " " | " echo -e " 8) Re${bgd}m${reset}ove from queue " " | " " 18) " " | " echo -e " 9) ${bgd}C${reset}lear queue " " | " " 19) " " | " @@ -549,6 +549,7 @@ soco_lists() { 13|e|E) list_13;; 14|l|L) list_14;; 15|d|D) list_15;; + 16|k|K) list_16;; 20|r|R) exec "$0";; *) echo -e "\n${red}Oops!!! Please Select Correct Choice${reset}"; echo -e "Press ${bold}ENTER${reset} To Continue..." ; read ;; @@ -677,6 +678,29 @@ list_15() { # Give an error if empty playlist } +# Remove a track from a Sonos playlist +list_16() { + playing="Remove a track from a Sonos playlist..." + echo -e "\n\033[1m $playing \033[0m" + + while : + do + echo -e "\nList of Sonos playlist:" + sonos $loc $device list_playlists + + read -p "Enter a playlist : " lsp + sonos $loc $device list_playlist_tracks "$lsp" + # Error: Can't pickle : attribute lookup MSTrack on soco.music_services.data_structures failed + # Erreur si la playlist contient des podcasts, pistes Deezer. Ok pour les mp3 dela Library. + + read -p "Enter the track to remove or [q] to quit: " trk + if [[ "$trk" == "q" || "$trk" == "Q" ]]; then break; fi + sonos $loc $device remove_from_playlist "$lsp" "$trk" + # Give an error if empty playlist + done + } + + # Soco device Infos Menu soco_infos() {