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

23 lines
727 B
Plaintext
Raw Normal View History

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