[英]MPD: receive actual mpd-status with Linux bash script
I want to know how to receive the actual status of the mpd player with a linux bash script. 我想知道如何使用linux bash脚本接收mpd播放器的实际状态。 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. ...但我需要知道mpd是否正在播放一首歌。 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. 我尝试用mpcstatus=cat /var/tmp/mpd_status
或actvol=cat /var/tmp/mpd_volume
接收它,但文件不存在。 I'm working with Volumio /Debian on a RaspberryPi. 我正在使用RaspberryPi上的Volumio / Debian。
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]*//'`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.