function jsonmethodcall($method, $args = array(), $service_uri = "") { $request = jsonstring($method, $args); return jsoncall($request, $service_uri); }
function playSongFromList($songid) { echo "1"; $jsonVersion = jsonmethodcall("JSONRPC.Version"); //pull the JSON version # from XBMC $results = jsonmethodcall("Player.GetActivePlayers"); if (!empty($results)) { if ($results['result']['audio'] == 1) { if ($jsonVersion['result']['version'] == '2') { $request = jsonstring("AudioPlaylist.Add", $songid); } if ($jsonVersion['result']['version'] == '3') { $request = jsonstring("AudioPlaylistV3.Add", $songid); } } else { if ($jsonVersion['result']['version'] == '2') { $request = jsonstring("XBMC.Play", '"songid": ' . $songid); } if ($jsonVersion['result']['version'] == '3') { jsoncall(jsonstring("AudioPlaylist.Clear")); jsoncall(jsonstring("AudioPlaylistV3.Add", $songid)); jsoncall(jsonstring("AudioPlaylist.Play")); } } $results = jsoncall($request); if (empty($results)) { echo $COMM_ERROR; echo "<pre>{$request}</pre>"; } } else { echo $COMM_ERROR; } }
function playSongFromList($songid) { $results = jsonmethodcall("Player.GetActivePlayers"); if (!empty($results)) { if ($results['result']['audio'] == 1) { $request = jsonstring("AudioPlaylist.Add", $songid); } else { $request = jsonstring("XBMC.Play", '"songid": ' . $songid); } $results = jsoncall($request); if (empty($results)) { echo $COMM_ERROR; echo "<pre>{$request}</pre>"; } } else { echo $COMM_ERROR; } }