dotfiles/.bin/apps/amused

59 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-12-06 08:01:44 +01:00
#!/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";
2022-12-06 08:01:44 +01:00
amused show | sort -R | amused load;
NOTIFY_CMD "shuffle finished";
2022-12-06 08:01:44 +01:00
)&}
amused_sort() {(
NOTIFY_CMD "sorting started in background"
2022-12-06 08:01:44 +01:00
amused show | sort -u | amused load
NOTIFY_CMD "sorting finished"
2022-12-06 08:01:44 +01:00
)&}
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"
2022-12-06 08:01:44 +01:00
)&}
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"
2022-12-06 08:01:44 +01:00
)&}
amused_cmd() {
amused "${@}"
NOTIFY_CMD "$(amused status | head -1 | cut -d'/' -f5-)"
2022-12-06 08:01:44 +01:00
}
case "${SEL}" in
play) amused_cmd play; ;;
prev) amused_cmd prev; ;;
2022-12-06 08:01:44 +01:00
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