This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles-old/scripts/.local/bin/musmenu

46 lines
907 B
Plaintext
Raw Normal View History

2019-12-01 23:21:31 +01:00
#!/bin/sh
2019-12-02 00:20:30 +01:00
set -e
2019-12-01 23:21:31 +01:00
2020-04-28 00:24:16 +02:00
menu=wdmenu
2020-04-20 04:27:35 +02:00
2019-12-02 00:20:30 +01:00
search(){
2020-04-20 04:27:35 +02:00
music=$(mpc playlist --format '%artist% : %title%' | sed '/^ : $/d' | $menu)
2019-12-03 04:38:10 +01:00
if [ "$music" == "" ]
then
exit 1
fi
2019-12-02 00:20:30 +01:00
artist=$(echo "$music" | perl -pe 's/(.*) : (.*)/\1/')
title=$(echo "$music" | perl -pe 's/(.*) : (.*)/\2/')
2019-12-01 23:21:31 +01:00
2019-12-05 15:28:02 +01:00
mpc --quiet searchplay artist "$artist" title "$title"
2019-12-02 00:20:30 +01:00
}
delete(){
current=~/Música/"$(mpc current -f %file%)"
2020-04-20 04:27:35 +02:00
answer=$(echo -e "nothing\n$current" | $menu -p"delete?" )
2019-12-03 04:38:10 +01:00
if [ "$answer" == "$current" ]
2019-12-02 00:20:30 +01:00
then
2019-12-03 04:38:10 +01:00
trash "$answer"
2019-12-05 15:28:02 +01:00
mpc --quiet next
mpc --quiet update
2019-12-02 00:20:30 +01:00
fi
}
usage(){
echo "Commands: "
echo " $0 search -- searches the current playlist for songs and plays it"
echo " $0 delete -- prompts to delete the current song"
}
if [ "$1" == "delete" ]
then
delete
elif [ "$1" == "search" ]
then
search
else
usage
2019-12-09 19:25:42 +01:00
search
2019-12-02 00:20:30 +01:00
fi