From d731468c1841b3f43eeb98f2e3d8fb49de3bfea5 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Tue, 1 Sep 2015 03:18:08 +0200 Subject: fix deletion code in playlist --- clerk | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/clerk b/clerk index b559237..147aeb8 100755 --- a/clerk +++ b/clerk @@ -581,11 +581,19 @@ resumePlaylist () { # Play or delete items from current Queue dplayQueue () { while true; do - re='^[0-9]+$' - if [[ "$POS" =~ $re ]]; then - POS=$(( $POS + 6 )) + if [[ -z $POS ]]; then + re='^[0-9]+$' + if [[ "$POS" =~ $re ]]; then + POS=$(echo $(( $POS + 2 ))) + else + POS=0 + fi else - POS=0 + if [[ $last != $(mpc -f '%file%' playlist | tail -1) ]]; then + POS=$(echo $(( $POS + 5 ))) + else + POS=$(echo $(( $POS + 6 ))) + fi fi select="-selected-row $POS" @@ -614,6 +622,7 @@ TRACKDISPLAY=$(echo -e "< Return\n---\nLoad Playlist\nLoad RSS\nSave Playlist\n- POS=$(echo "${TRACKDISPLAY}" | awk '{ print $1 }') if [[ $val -eq 10 ]]; then + last=$(mpc playlist -f '%file%' | tail -1) mpc del $POS; POS=$(( $POS - 1)); dplayQueue -- cgit v1.2.3-24-g4f1b