Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Receive is Webradio playing
#2
(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:
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
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:
Code:
curl "http://127.0.0.1/commands.php/?cmd=play"

@mezcal 

Interesting approach.

First, props for using netcat Smile 

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
Reply


Messages In This Thread
Receive is Webradio playing - by mezcal - 07-22-2018, 06:12 AM
RE: Receive is Webradio playing - by TheOldPresbyope - 07-22-2018, 01:24 PM
RE: Receive is Webradio playing - by Tim Curtis - 07-22-2018, 05:46 PM
RE: Receive is Webradio playing - by Tim Curtis - 07-22-2018, 07:06 PM
RE: Receive is Webradio playing - by mezcal - 07-22-2018, 08:26 PM

Forum Jump: