This example will show you how to add a radio stream ButtonsDevice.
Installation
Install MPlayer (supporting most media streams)
sudo apt-get install mplayer
Device
Add a ButtonsDevice
{
"id": "radio",
"name": "Fresh FM",
"class": "ButtonsDevice",
"buttons": [
{
"id": "radio-on",
"text": "On"
},
{
"id": "radio-pause",
"text": "Pause"
},
{
"id": "radio-off",
"text": "Off"
},
{
"id": "lessvolume",
"text": "-"
},
{
"id": "morevolume",
"text": "+"
}
]
},
Rules
Add rules
Radio Stream On
IF radio-on is pressed THEN execute "mkfifo /home/pi/tmp/fifofile > /dev/null 2>&1 &" and execute "mplayer -slave -input file=/home/pi/tmp/fifofile http://edge1-icecast.538.lw.triple-it.nl/SLAMFM_MP3 > /dev/null 2>&1 &"
Radio Stream Pause & Resume
IF radio-pause is pressed THEN execute "echo pause >> /home/pi/tmp/fifofile"
Radio Stream Off
IF radio-off is pressed THEN execute "echo stop >> /home/pi/tmp/fifofile"
Radio Stream Volume -
IF radio-lessvolume is pressed THEN execute "echo volume -1 >> /home/pi/tmp/fifofile"
Radio Stream Volume +
IF radio-morevolume is pressed THEN execute "echo volume +1 >> /home/pi/tmp/fifofile"
More controls can be found here: http://www.mplayerhq.hu/DOCS/tech/slave.txt