07-22-2018, 06:12 AM
Hi all,
I have succesfully set up Apple remote to control moode. This remote has one button for play/stop. I use commad mpc toggle.
It works fine but for webradios is better stop then pause as GUI does. My approach is:
If the filename of a playing track starts with 'http' it is webradio. I am affraid it can catch tidal. For tidal is pause better then stop.
Is any way how to execute GUI commands. Something like:
I have succesfully set up Apple remote to control moode. This remote has one button for play/stop. I use commad mpc toggle.
It works fine but for webradios is better stop then pause as GUI does. My approach is:
Code:
http=$(echo -e "currentsong\nclose" | nc localhost 6600 | grep file: | sed 's/file: //' | cut -c -4)
status=$(echo -e "status\nclose" | nc localhost 6600 | grep state: | sed 's/state: //')
if [ "$http" == 'http' ] && [ "$status" == 'play' ]; then # radio
mpc stop
else
mpc toggle
fi
Is any way how to execute GUI commands. Something like:
Code:
curl "http://127.0.0.1/commands.php/?cmd=play"