ba54cf5032
split behaviour for "stop" to avoid shenanigans when looking for the album art
23 lines
732 B
Bash
Executable File
23 lines
732 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
######################################################################
|
|
# @author : swytch (swytch@$HOSTNAME)
|
|
# @file : player
|
|
# @license : MIT
|
|
# @created : Friday Feb 05, 2021 21:42:00 CET
|
|
#
|
|
# @description : Simple wrapper to mpc, to send notifications
|
|
######################################################################
|
|
|
|
|
|
if [ "$1" = "stop" ]; then
|
|
mpc $1
|
|
dunstify -r 10010 -u "normal" "MPD" "Music stopped"
|
|
else
|
|
export MPC_FORMAT="Artist: <b>%artist%</b> \nTitle: %title% \nAlbum: %album%"
|
|
out="$(mpc $1 | head -n-1)"
|
|
path="$(mpc --format %file% | head -n1 | awk -F '/' '{ printf "music/%s/%s/cover.png\n", $1,$2 }')"
|
|
|
|
dunstify -r 10010 -u "normal" -i "$HOME/$path" "MPD" "$out"
|
|
fi
|