This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.local/bin/player
David JULIEN e0eaf5e4b9 feat: simplify player
exit on music stop (no notification)

doesn't call statusbar update
2021-03-10 22:59:43 +01:00

24 lines
730 B
Bash
Executable File

#!/usr/bin/env sh
######################################################################
# @author : swytch (swytch@$HOSTNAME)
# @file : player
# @license : GPLv3
# @created : Friday Feb 05, 2021 21:42:00 CET
#
# @description : simple wrapper for mpc, to send notifications
######################################################################
MPC_FORMAT="Artist: <b>%artist%</b> \nTitle: %title% \nAlbum: %album%"
out="$(mpc --format "$MPC_FORMAT" $1 | head -n-1)"
kill -39 $(pidof dwmblocks)
if [ -z "$out" ]; then
exit
else
path="$(mpc --format %file% | head -n1 | awk -F '/' '{ printf "music/%s/%s/cover.jpg\n", $1,$2 }')"
echo $path
dunstify -r 10010 -u "normal" -i "$HOME/$path" "MPD" "$out"
fi