07-22-2018, 01:24 PM
(07-22-2018, 06:12 AM)mezcal Wrote: 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.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"
@mezcal
Interesting approach.
First, props for using netcat
Second, perhaps I'm misunderstanding your request, but it looks like the logic you seek isn't handled in php but in javascript. Have a look at js/scripts-panels.js where moOde decides what to do with Play/Pause clicks. Once it's decided, it uses the function sendMpdCmd() to invoke the commands you already know.
Tim's the Guru on this. I just bird-walk through his code from time to time.
Regards,
Kent