dotfiles/.bin/apps/amused
2023-11-04 10:58:13 +01:00

59 lines
1.3 KiB
Bash
Executable File

#!/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-send "shuffle started in background";
amused show | sort -R | amused load;
notify-send "shuffle finished";
)&}
amused_sort() {(
notify-send "sorting started in background"
amused show | sort -u | amused load
notify-send "sorting finished"
)&}
amused_load_tank() {(
notify-send "loading started in background"
amused load < /home/sdk/.music.all.txt
notify-send "loading finished"
)&}
amused_load_local() {(
notify-send "loading started in background"
find ~/MusicSelection -type f | amused load
notify-send "loading finished"
)&}
amused_cmd() {
amused "${@}"
notify-send "$(amused status | head -1 | cut -d'/' -f5-)"
}
case "${SEL}" in
play) amused_cmd play; ;;
prev) amused_cmd pref; ;;
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