helm/os/arch/.config/panel/lemons/music

27 lines
752 B
Plaintext
Raw Normal View History

#!/usr/bin/env dash
2016-11-02 16:58:47 -07:00
while :
do
output=$(mpc --format ";%title%;%artist%;%album%")
if echo $output | grep "^;" 2>&1 >/dev/null
then
title=$(echo "$output" | head -1 | cut -d';' -f2)
artist=$(echo "$output" | head -1 | cut -d';' -f3)
album=$(echo "$output" | head -1 | cut -d';' -f4)
seek=$(echo "$output" | awk 'NR==2 {print $3}')
perc=$(echo "$output" | awk 'NR==2 {print $4}' | tr -d '()')
state=$(echo "$output" | awk 'NR==2 {print $1}')
case "$state" in
"[playing]") echo -n "SP" ;;
"[paused]") echo -n "Sp" ;;
*) echo -n "S " ;;
esac
echo "$title^$artist^$album^$seek^$perc"
else
echo "S"
fi
sleep 1
done