PHP Wrapper for XBMC JSON-RPC and HTTP-API - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116) +--- Thread: PHP Wrapper for XBMC JSON-RPC and HTTP-API (/showthread.php?tid=88388) |
- alshain - 2011-01-01 Hey, I've cleaned your script up a little. I've removed the redundant config checking code mostly. Both classes now wrap an Xbmc object, which serves as a universal class to build the configuration and check whether the XBMC instance can be reached. I've refactored the config processing as well, and should be easier now. I now also throws custom exceptions. https://gist.github.com/761851 GitHub's GISTs don't show diffs by defaults, but there are userscripts to do this for you. Alternatively you can just use a decent diff program or get the GIST's git repository. Oh... and I should note that this is completely untested, it may even have syntax errors - kaigoh - 2011-01-02 alshain Wrote:Hey, I've cleaned your script up a little. Thanks. alshain Wrote:Oh... and I should note that this is completely untested, it may even have syntax errors It does have some errors, I haven't had time to correct them yet, I'm hoping to do that tomorrow. I think I've figured out Subversion, too! Cheers, Kai. Update - kaigoh - 2011-01-03 After a tip from alshain, I've decided to move the project to GitHub. https://github.com/kaigoh/XBMC-PHP I have also repaired a bug that will cause a JSON-RPC error, so please grab the new code from GitHub. Cheers, Kai. Updated - kaigoh - 2011-01-03 Code updated. Cheers, Kai. - alshain - 2011-01-04 cool Now compiling PHP... so I can test my own code too hehe - kaigoh - 2011-01-04 alshain Wrote:cool Let me know how you get on! I had a quick tidy up today with the code, I have moved some stuff around...see what you think? Cheers, Kai. - alshain - 2011-01-04 Hey, I've update my code. You have a pull request. - kaigoh - 2011-01-05 alshain Wrote:Hey, I've update my code. You have a pull request. Done! Cheers mate, Kai. - alshain - 2011-01-05 cool - neus - 2011-05-14 im trying to learn how this api works but cant get it to work right the moviewall is showing now i want it to show just 1 movie $xbmcJson->VideoLibrary->GetMovieDetails ? ? someone can push me in the right direction ? thx in advantage - kaigoh - 2011-05-15 neus Wrote:im trying to learn how this api works but cant get it to work right Hi neus, If you look at the code here: PHP Code: foreach($moviesRaw->movies as $movie) { You can see we have a variable $moviesRaw->movies that contains all of the movies in your library. To reference a particular movie, you would call $movieRaw->movies[x] (where x is the array key), i.e. $movieRaw->movies[0] would show the first movie in your collection. HTH, Kai. - rickrude - 2011-12-28 Hey there Any plans to update this class to support EDEN? - ivarmedi - 2011-12-30 rickrude Wrote:Hey there It's just small changes that are needed. Here's a diff output: [HTML]# This patch file was generated by NetBeans IDE # It uses platform neutral UTF-8 encoding and \n newlines. --- W:\xbmc_remote\application\libraries\xbmc_2.php +++ W:\xbmc_remote\application\libraries\xbmc_json.php @@ -230,6 +230,7 @@ 'id' => $uid ); + $json = array_filter($json); $request = json_encode($json); $ch = curl_init(); @@ -265,12 +266,12 @@ public function __construct(xbmcHost $xbmcHost) { parent:etUrl($xbmcHost->url()); - $this->populateCommands($this->rpc("JSONRPC.Introspect")->commands); + $this->populateCommands($this->rpc("JSONRPC.Introspect")->methods); } private function populateCommands($remoteCommands) { - foreach($remoteCommands as $remoteCommand) { - $rpcCommand = explode(".", $remoteCommand->command); + foreach($remoteCommands as $cmd => $remoteCommand) { + $rpcCommand = explode(".", $cmd); if(!class_exists($rpcCommand[0])) { $this->$rpcCommand[0] = new xbmcJsonCommand($rpcCommand[0], parent::getUrl(), $this); } [/HTML] I wrote a simple wrapper for CodeIgniter aswell, if someone is interested. Just let me know here (it's on another computer). - rickrude - 2011-12-31 Thanks so much. You make it look so easy! RE: PHP Wrapper for XBMC JSON-RPC and HTTP-API - smilykoch - 2012-08-22 I know this post i old.. BUT! could some1 please help me get this working with the current stable version of xbmcBuntu.. (EDEN?)? I cant seem to get it working .. the closest i can get is with the error: Code: Fatal error: Uncaught exception 'XbmcException' with message 'Missing config key: host' in C:\xampp\htdocs\Remote\xbmc.php:126 |