#!/bin/bash
set -euo pipefail
[ $(mpc | wc -l) -eq 1 ] && {
printf '\uf9da'
exit
}
title=$(mpc | head -n1 | tr -cd "[:print:]" | sed 's/&/\&/g; s/\</g; s/>/\>/g')
state=$(mpc | grep '^\[' | sed -E 's/^\[(.+)\].*/\1/')
case ${state} in
playing)
printf '\uf909 %s' "${title}"
;;
paused)
printf '\uf8e3 %s' "${title}"
;;
*)
printf 'State: %s Title: %s' ${state} "${title}"
;;
esac