Initial Commit
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
MUSIC_DIR=/server/music
|
||||
|
||||
menu_show() {
|
||||
if mpc_not_playing; then
|
||||
opc=$(echo -e "1) Mostrar Cola\n2) Eliminar Cola\n3) Buscar cancion\n4) Agregar Album" | rofi -dmenu -l 4 )
|
||||
else
|
||||
artist=$(mpc -f "%artist%" | head -1)
|
||||
song=$(mpc -f "%title%" | head -1)
|
||||
opc=$(echo -e "1) Mostrar Cola\n2) Eliminar Cola\n3) Buscar cancion\n4) Agregar Album" | rofi -dmenu -l 4 -mesg "$(echo -e "$artist\n$song")" -p "")
|
||||
fi
|
||||
case $opc in
|
||||
"1) Mostrar Cola")
|
||||
show_queue
|
||||
;;
|
||||
"2) Eliminar Cola")
|
||||
mpc clear
|
||||
/usr/bin/reprmpc
|
||||
;;
|
||||
"3) Buscar cancion")
|
||||
search_song
|
||||
;;
|
||||
"4) Agregar Album")
|
||||
add_album
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
add_album() {
|
||||
album_unparsed="$(mpc list album | rofi -dmenu -l 10 rofi -dmenu -l 10 -kb-custom-1 "d" -mesg "$(echo -e "Presione la tecla Enter para añadir album a la cola\nPresione la tecla d para insertar album a la cola")" -p "" )"
|
||||
code=$?
|
||||
case $code in
|
||||
0)
|
||||
mpc find album "$album_unparsed" | mpc add && notify-send "Added album $(echo "$album_unparsed")"
|
||||
menu_show
|
||||
;;
|
||||
10)
|
||||
mpc find album "$album_unparsed" | mpc add && notify-send "Inserted album $(echo "$album_unparsed")"
|
||||
menu_show
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
mpc_not_playing() {
|
||||
if [[ -z $(mpc | grep -iE "playing|paused") ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
show_queue() {
|
||||
song=$(mpc -f "[%position%] %artist% - %title%" playlist | rofi -dmenu -l 10 -kb-custom-1 "d" -p)
|
||||
code=$?
|
||||
case $code in
|
||||
0)
|
||||
mpc play $(echo $song | awk '{print $1}')
|
||||
show_queue
|
||||
/usr/bin/reprmpc
|
||||
;;
|
||||
10)
|
||||
mpc del $(echo $song | awk '{print $1}')
|
||||
show_queue
|
||||
/usr/bin/reprmpc
|
||||
;;
|
||||
esac
|
||||
/usr/bin/reprmpc
|
||||
|
||||
|
||||
}
|
||||
|
||||
search_song() {
|
||||
song_and_artist="$(mpc listall -f "%title% - %artist%\t\t\t\t\t\t\t\t\t\t\t\t%file%" | rofi -dmenu -l 10 -kb-custom-1 "alt+a" -mesg "$(echo -e "Presione la tecla Enter para reproducir cancion\nPresione la tecla alt+a para añadir a la cola")" -p "" )"
|
||||
code=$?
|
||||
file=$(echo "$song_and_artist" | cut -f13 )
|
||||
case $code in
|
||||
0)
|
||||
mpc insert "$file" && mpc next >/dev/null && notify-send "Playing $(mpc -f "%artist% - %title%" | head -1)"
|
||||
mpc play
|
||||
;;
|
||||
10)
|
||||
mpc insert "$file" && notify-send "Added $(echo "$song_and_artist" | cut -f1 )"
|
||||
search_song
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
menu_show
|
||||
Reference in New Issue
Block a user