XBMC-PHP-RPC - a PHP JSON-RPC library supporting HTTP and TCP

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
DKreeK Offline
Junior Member
Posts: 21
Joined: Jan 2010
Reputation: 0
Post: #11
Thank you very much, I will test tonight as soon as I get backWink
find quote
DKreeK Offline
Junior Member
Posts: 21
Joined: Jan 2010
Reputation: 0
Post: #12
It works very fine. Thank you
find quote
Mindzai Offline
Fan
Posts: 333
Joined: Aug 2010
Reputation: 0
Post: #13
Good to hear Smile
find quote
Ghostface Offline
Junior Member
Posts: 21
Joined: Jun 2008
Reputation: 0
Location: Austria
Post: #14
I have been using your wrapper but ran into a problem when trying to fetch my whole Movie DB.

I might be wrong but it looks like you are trying to decode a non utf-8 string which fails as soon as you have some weird foreign movies in your DB.

Changin this function to utf8_encode the string solved my problem:

PHP Code:
private function decodeResponse($json) {
        return 
json_decode(utf8_encode($json), true);


I checked the php.ini is running with a default_charset of utf-8 so I am not exactly sure if the problem is due to me having something configured the wrong way.

Anyways good job with the wrapper and maybe this is usefull info, if I did something wrong please let me know Smile
find quote
darkscout Offline
Posting Freak
Posts: 2,148
Joined: Jul 2008
Reputation: 12
Post: #15
Some small changes. xbmc.php, line 295. I was getting a warning that index 0 didn't exist, so I changed it to this:

Code:
    public function __call($method, $args = null) {
        if (array_key_exists(0,$args))
            return $this->_xbmcJson->rpc($this->_name.".".$method, $args[0]);
        return $this->_xbmcJson->rpc($this->_name.".".$method);
    }

Also, in the example wall, I changed the code to this, that way I could track down what movies I needed images for, plus I didn't have a broken img tag:

Code:
//Display the "movie-wall"
foreach($movies as $movie) {
    if (array_key_exists('thumbnail',$movie))
    $moviesHTML .= "<img src=\"http://".$xbmcHost->url()."/".$xbmcJson->Files->Download($movie['thumbnail'])->path."\" width=\"104\" height=\"156\" title=\"".$movie['title']."\">";
}

$moviesHTML .= "<br><br><h3>Movies Without Thumbs</h3>";
foreach($movies as $movie) {
    if (!array_key_exists('thumbnail',$movie))
    $moviesHTML .= "<br>".$movie['title'];
}

$moviesHTML .= "<br><br><h3>Movies Without Fanart</h3>";
foreach($movies as $movie) {
    if (!array_key_exists('fanart',$movie))
    $moviesHTML .= "<br>".$movie['title'];
}

[Image: aeKO.jpeg]
Code:
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
find quote
Mindzai Offline
Fan
Posts: 333
Joined: Aug 2010
Reputation: 0
Post: #16
Ghostface, thanks for the bug report I will look into this today.

darkscout, that isn't my code! Rofl I think you may have the wrong thread Smile
(This post was last modified: 2011-02-11 07:09 by Mindzai.)
find quote
darkscout Offline
Posting Freak
Posts: 2,148
Joined: Jul 2008
Reputation: 12
Post: #17
You are correct Sir. No clue where I got this PHP library from Smile

[Image: aeKO.jpeg]
Code:
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
find quote
Mindzai Offline
Fan
Posts: 333
Joined: Aug 2010
Reputation: 0
Post: #18
@Ghostface

I was unable to reproduce your issue. I added some movies to the database with accented European characters. XBMC always returned UTF-8 encoded responses.

Can you give me some more details about your OS and an example of a movie title which is causing a problem. Could you also please let me know what issue you are having specifically (ie any PHP errors).

I have added some code which will attempt to convert non-UTF-8 encoded string into UTF-8 which may or may not solve your issue, but as I say it's hard for me to confirm as I can't reproduce the issue.
find quote
Ghostface Offline
Junior Member
Posts: 21
Joined: Jun 2008
Reputation: 0
Location: Austria
Post: #19
Nevermind, actually adding utf8_encode messes up regular german chars.

I nailed the problem down to one particular Movie that had strange characters in the filename (so strange they only show up as Confused in my terminal)

after utf8_encoding that filename they resulted in:
Quote:ÔÂÇò

The error message btw was:

Quote:Invalid JSON RPC response

I simply renamed that file and all should be good now.

Thanks for checking tho!
find quote
Mindzai Offline
Fan
Posts: 333
Joined: Aug 2010
Reputation: 0
Post: #20
OK thanks for letting me know Smile
find quote
Post Reply