diff options
author | Rasmus Steinke <rasi@xssn.at> | 2015-09-01 03:18:08 +0200 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2015-09-01 03:18:08 +0200 |
commit | d731468c1841b3f43eeb98f2e3d8fb49de3bfea5 (patch) | |
tree | 98716726177bf2170a8c52aaabe684ebf4b91552 | |
parent | e811f9190bf95023158f2db2d5b3856b199bb574 (diff) | |
download | perl-app-clerk-d731468c1841b3f43eeb98f2e3d8fb49de3bfea5.tar.gz perl-app-clerk-d731468c1841b3f43eeb98f2e3d8fb49de3bfea5.tar.xz |
fix deletion code in playlist
-rwxr-xr-x | clerk | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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 |