This page last changed on Apr 27, 2015 by glennl.

For the benefit of @jules_bike and possibility other members, here is a rough a dirty way to get Radio metedata to show using JSON Path.

This assumes you are using jishi -node-sonos-http-api to get the information in the first place, the problem with radio stations is the metadata is stored in different fields.

This becomes problematic when switching from local tracks to radio tracks for example radio is under streamInfo, while we usually look for title, album and artist.

The solution is to simply replace those fields when we notice that type = radio.

My code has no validation but should give you a very good idea on how to start, in my local version i have added additional fields for retrieving album art if not visible.

To use the script you do the following

http://web address of php script/?ip=(ip of node-sonos)&room=(room name)

Example would be

Let me know if you need any help, by adding PHP to OpenRemote you can do much more as it's very flexible and customizable, I run this all on a Raspberry Pi 2 and have no issues


$ip = $_GET['ip'];
$room = $_GET['room'];

$sonos = 'http://' . $ip . ':5005/' . $room .  '/state';

$json = json_decode(file_get_contents(trim($sonos)));

//type radio or song

//Album Info
$title = $json->currentTrack->title;
$artist=  $json->currentTrack->artist;
$album= $json->currentTrack->album;

$albumart =  $json->currentTrack->albumArtURI;
$absoluteart = $json->currentTrack->absoluteAlbumArtURI;

if ($type == "radio") {
	$album = substr($json->currentTrack->radioShowMetaData,0,-8);
	$artist =  $radiosong;

$metadata = array
  "currentTrack" => array('title' => $title, 'artist' => $artist, 'album' => $album,  'albumArtURI' => $albumart,'absoluteAlbumArtURI' => $absoluteart ),

echo json_encode($metadata);


Hi Glenn thanks for the help - just for clarification in OR do you create a command using the http protocol which polls this address and uses a json path expression to extract the data?

What do I name the script?

Posted by jules_bike at Apr 27, 2015 17:17

Got it in one, you can name it whatever you want.

All that matters is that its HTTP GET in OR and it includes the JSON Path expression

Last me know how you go

Posted by glennl at Apr 28, 2015 02:04
Document generated by Confluence on Jun 05, 2016 09:30