From Pimagical

This example will show you how to add a radio stream ButtonsDevice.

Radio ButtonDevice

Installation

Install MPlayer (supporting most media streams)

sudo apt-get install mplayer

Make a slave input file

mkfifo /tmp/fifofile

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 "mplayer -slave -input file=/tmp/fifofile http://www.fresh.fm/media/audio/ListenHigh.pls > /dev/null 2>&1 &"

Radio Stream Pause & Resume

IF radio-pause is pressed THEN execute "echo pause >> /tmp/fifofile"

Radio Stream Off

IF radio-off is pressed THEN execute "echo stop >> /tmp/fifofile"

Radio Stream Volume -

IF radio-lessvolume is pressed THEN execute "echo volume -1 >> /tmp/fifofile"

Radio Stream Volume +

IF radio-morevolume is pressed THEN execute "echo volume +1 >> /tmp/fifofile"

More controls can be found here: http://www.mplayerhq.hu/DOCS/tech/slave.txt