I want to know how to receive the actual status of the mpd player with a linux bash script. I know how to start and stop the player...
#!/bin/bash
mpc play
mpc volume +1
mpc stop
...but i need to know if mpd is playing a song or not. Also the current volume setting is interesting.
I tried to receive it with mpcstatus=cat /var/tmp/mpd_status
or actvol=cat /var/tmp/mpd_volume
but the files do not exist. I'm working with Volumio/Debian on a RaspberryPi.
I've got it!
Play:
if mpc status | grep playing >/dev/nul # If mpd is playing
then
command...
fi
Volume:
ACTVOL=`mpc status | sed -n '/volume/p' | cut -c8-10 | sed 's/^[ \t]*//'`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With