Receive is Webradio playing - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7) +--- Thread: Receive is Webradio playing (/showthread.php?tid=339) |
Receive is Webradio playing - mezcal - 07-22-2018 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) Is any way how to execute GUI commands. Something like: Code: curl "http://127.0.0.1/commands.php/?cmd=play" RE: Receive is Webradio playing - TheOldPresbyope - 07-22-2018 (07-22-2018, 06:12 AM)mezcal Wrote: Hi all, @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 RE: Receive is Webradio playing - Tim Curtis - 07-22-2018 Bird Walk ;-) https://www.youtube.com/watch?v=L81maEBjvgc There are two WebAPI's for moOde 1. MPD command API http://moode/command?cmd=play http://moode/command?cmd=pause 2. Volume API http://moode/command?cmd=vol.sh 10 Here is the help for vol.sh pi@rp3:~ $ /var/www/vol.sh -help vol.sh with no arguments will print the current volume level vol.sh restore will set alsa/mpd volume based on current knob setting vol.sh <level between 0-100>, mute (toggle), up <step> or dn <step>, -help -Tim RE: Receive is Webradio playing - TheOldPresbyope - 07-22-2018 (07-22-2018, 05:46 PM)Tim Curtis Wrote: Bird Walk ;-) Now THAT's what I'm talkin' about! Quote:There are two WebAPI's for moOde I got the impression @mezcal needed context-sensitive control. It wouldn't be the first time I was wrong. Regards, Kent RE: Receive is Webradio playing - Tim Curtis - 07-22-2018 I think u might be right. You can get output from any MPD command via the Web command API. You can use curl and localhost on the Pi or you can run from a client Web Browser via http://hostname/command?cmd= For example: Code: pi@rp3:~ $ curl http://localhost/command/?cmd=currentsong RE: Receive is Webradio playing - mezcal - 07-22-2018 I am newbie to moodeaudio and mpd. I have been going through source code. play/pause button is defined in js/scripts-panels.js: Code: if (MPD.json['file'].substr(0, 4).toLowerCase() == 'http') { I have found in inc/playerlib.php division of formats: Code: // radio station Artist 'Radio station' is adding in command/worker.php Code: if (isset($song['Name']) || (substr($song['file'], 0, 4) == 'http' && !isset($song['Artist']))) { The condition above should be used for webradio. I will try write it in bash. I think js test for http is case insensitive and php tests are case sensitive. |