#!/bin/sh . $HOME/.bin/_config showlist() { printf '%s\n' \ "next prev play stop shuffle sort load tank load local --------- > $(amused status | head -1 | sed 's,/tank/pub/Audio_/,,g') ---------" amused show | cut -d'/' -f5- } SEL="$( showlist | $DMENU_CMD -p Playlist -l 30)" amused_shuffle() {( NOTIFY_CMD "shuffle started in background"; amused show | sort -R | amused load; NOTIFY_CMD "shuffle finished"; )&} amused_sort() {( NOTIFY_CMD "sorting started in background" amused show | sort -u | amused load NOTIFY_CMD "sorting finished" )&} amused_load_tank() {( NOTIFY_CMD "loading started in background" ssh 192.168.1.20 "find /tank/pub/Audio_* -type f" | grep -Ev "jpg|jpeg|png|gif|/[Cc]over\." | amused load NOTIFY_CMD "loading finished" amused_cmd play )&} amused_load_local() {( NOTIFY_CMD "loading started in background" find /home/sdk/Music -type f | grep -Ev "jpg|jpeg|png|gif|/[Cc]over\." | amused load NOTIFY_CMD "loading finished" amused_cmd play )&} amused_cmd() { amused "${@}" NOTIFY_CMD "$(amused status | head -1 | cut -d'/' -f5-)" } case "${SEL}" in play) amused_cmd play; ;; prev) amused_cmd prev; ;; stop) amused_cmd stop; ;; next) amused_cmd next; ;; shuffle) amused_shuffle; ;; sort) amused_sort; ;; load*tank) amused_load_tank; ;; load*local) amused_load_local; ;; *) amused_cmd jump "${SEL}"; ;; esac