summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2015-12-09 18:07:35 +0100
committerRasmus Steinke <rasi@xssn.at>2015-12-09 18:07:35 +0100
commitd3c2b8cc3c5b306578215d623008426d46f7dcab (patch)
tree4e02549fb2e98910d28b6aba6e78d8fe1feb77f2
parentd6a6904b0ff55af330e331436a9ed3276bc42eb3 (diff)
downloadclerk-multiselect.tar.gz
clerk-multiselect.tar.bz2
make queue menu multilinemultiselect
-rwxr-xr-xclerk74
1 files changed, 47 insertions, 27 deletions
diff --git a/clerk b/clerk
index f9a0886..f16a88d 100755
--- a/clerk
+++ b/clerk
@@ -797,7 +797,8 @@ songs () {
elif [[ $val -eq 10 ]]; then
last=$(mpc playlist -f '%file%' | tail -1)
mpc del $POS;
- POS=$(( $POS - 1));
+ POS2=$(echo "$POS" | head -1)
+ POS=$(( $POS2 - 1));
dplayQueue
elif [[ $val -eq 19 ]]; then
@@ -858,39 +859,58 @@ songs () {
elif [[ $val -eq 25 ]]; then
unset last
if [[ $TRACKDISPLAY_NEW == *">"* || $TRACKDISPLAY_NEW == *"<"* || $TRACKDISPLAY_NEW == "---" ]]; then
- trackids="$(echo -e "$POS\n" | sed \$d)"
- playlist=$(mpc playlist -f '%position%')
- echo "$trackids $playlist"
- exit
-# mpc del $deltracks
-# mpc crop
+ mpc crop
else
mpc play $POS;
- trackids="$(echo -e "$POS\n" | sed \$d | sort)"
- playlist=$(mpc playlist -f '%position%' | sort)
- delids=$(diff <(mpc playlist -f '%position%' | sort) <(echo -e "$trackids\n") | awk '{print $2}')
- clear
- echo "$delids"
- exit
+ mpc crop
fi
elif [[ $val -eq 16 ]]; then
- unset last
- trackids="$(echo -e "$POS\n" | sed \$d | tac)"
- POS=$(echo -e "$trackids" | tail -1)
- echo "$trackids" | while read POS2; do
- mpc mv $POS2 $(echo $(( $POS2 + 1 )))
- done
- POS=$(echo $(( $POS +1 )))
+ if [[ $(echo "$TRACKDISPLAY_NEW" | wc -l) -gt 1 ]]; then
+ unset last
+ posSelect=$(echo "$(songs)" | dmenu_t -dmenu -mesg "Move after >")
+ if [[ $posSelect == "" ]]; then
+ exit;
+ else
+ chosenPos=$(echo "$posSelect" | awk -F ' ' '{print $1}')
+ trackids="$(echo -e "$POS\n" | sed \$d)"
+ POS=$(echo -e "$trackids" | head -1)
+ echo "$trackids" | while read POS2; do
+ mpc mv $POS2 $(( $chosenPos +1 ))
+ chosenPos="$(( $chosenPos +1 ))"
+ done
+ POS=$(echo "${chosenPos}");
+ fi
+ else
+ unset last
+ mpc mv $POS $(echo $(( $POS + 1 )))
+ POS=$(echo $(( $POS + 1 )));
+ fi
+
+
elif [[ $val -eq 15 ]]; then
- unset last
- trackids="$(echo -e "$POS\n" | sed \$d)"
- POS=$(echo -e "$trackids" | head -1)
- echo "$trackids" | while read POS2; do
- mpc mv $POS2 $(echo $(( $POS2 - 1 )))
- done
- POS=$(echo $(( $POS - 1 )));
+ if [[ $(echo "$TRACKDISPLAY_NEW" | wc -l) -gt 1 ]]; then
+ unset last
+ posSelect=$(echo "$(songs)" | dmenu_t -dmenu -mesg "Move after >")
+ if [[ $posSelect == "" ]]; then
+ exit;
+ else
+ chosenPos=$(echo "$posSelect" | awk -F ' ' '{print $1}')
+ trackids="$(echo -e "$POS\n" | sed \$d)"
+ POS=$(echo -e "$trackids" | head -1)
+ echo "$trackids" | while read POS2; do
+ mpc mv $POS2 $(( $chosenPos +1 ))
+ chosenPos="$(( $chosenPos +1 ))"
+ done
+ POS=$(echo "${chosenPos}");
+ fi
+ else
+ unset last
+ mpc mv $POS $(echo $(( $POS - 1 )))
+ POS=$(echo $(( $POS - 1 )));
+ fi
+
elif [[ $val -eq 17 ]]; then
unset last