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
dann0 Offline
Junior Member
Posts: 29
Joined: Jan 2011
Reputation: 0
Post: #61
holidays... lucky you Smile

Its fgets() that is timing out, and its not EOF thats missing from the response (i guess we don't expect one using TCP) its 'new line'. When i look at the raw response using telnet, the cursor moves to the next line using XBMC ver 10.1 but does not using the nightly version.

I will bring it up in the JSON-RPC thread and hopefully by the time you get back this part of the problem will be solved.
find quote
Mindzai Offline
Fan
Posts: 333
Joined: Aug 2010
Reputation: 0
Post: #62
That would make sense. If it's intended behaviour from the server I can work around it, but I'll wait and see what the devs say before I do anything in case it's a bug on the server's end.
find quote
dann0 Offline
Junior Member
Posts: 29
Joined: Jan 2011
Reputation: 0
Post: #63
Ok, word is its not a bug, but intended behaviour see here

I might try making a feature request to allow a forced EOL char at the end of the response, but i guess realistically a workaround will be required... fgetc() perhaps, but that seems to be somewhat inefficient.

I'm looking forward to seeing what you come up with!
find quote
torianironfist Offline
Junior Member
Posts: 16
Joined: Dec 2008
Reputation: 0
Post: #64
Hi,

This is great. A very useful wrapper. I have used it it write a script to tweet the currently playing Movie/TvShow.

I would like to call this every time a new video is started. Is there any easy ways to get the JSON announcements that xbmc sends across the TCP port?

If I telnet into port 9090 I get notification when playback starts

{
"jsonrpc" : "2.0",
"method" : "Announcement",
"params" : {
"message" : "PlaybackStarted",
"sender" : "xbmc"
}
}

Is there a way to read this using this wrapper?
If not is there a way to implement this.

Thanks
find quote
Mindzai Offline
Fan
Posts: 333
Joined: Aug 2010
Reputation: 0
Post: #65
dann0 Wrote:Ok, word is its not a bug, but intended behaviour see here

I might try making a feature request to allow a forced EOL char at the end of the response, but i guess realistically a workaround will be required... fgetc() perhaps, but that seems to be somewhat inefficient.

I'm looking forward to seeing what you come up with!

Apologies for the delay I have pushed a change for this. Could you please let me know if it fixes your problem?

torianironfist Wrote:Is there any easy ways to get the JSON announcements that xbmc sends across the TCP port?

It is certainly possible to write a listening client to do this, however using it would block any further activity. For this reason it would have to write to a buffer of some sort (file based I would guess as reading and writing session data without completing an HTTP request in between will not work) which is then read via an AJAX request from the client code. I guess on a LAN this would be speedy enough, but obviously there is the HTTP overhead etc. I would have to do some testing to ensure it could be done fast enough to be useful.

Unless anyone has any better suggestions?
find quote
samdret Offline
Junior Member
Posts: 18
Joined: Jan 2010
Reputation: 0
Post: #66
Do you have any plans of supporting Eden with this wrapper?
find quote
Romep Offline
Junior Member
Posts: 20
Joined: Feb 2011
Reputation: 0
Post: #67
How to get this to work with eden?
find quote
Romep Offline
Junior Member
Posts: 20
Joined: Feb 2011
Reputation: 0
Post: #68
My fault. Should have updated the files. TCP is a lot slower than HTTP, cause it has to read each character instead of a whole line. Any chance to get it faster again?
find quote
ranpow Offline
Junior Member
Posts: 13
Joined: Dec 2012
Reputation: 0
Post: #69
Is this wrapper support v6 prodo?
Iv made some tests and looks like im passing wrong params for example

The object desciption show

Player.Open
Start playback of either the playlist with the given ID, a slideshow with the pictures from the given directory or a single file or an item from the database.

array(4) { ["description"]=> string(158) "Start playback of either the playlist with the given ID, a slideshow with the pictures from the given directory or a single file or an item from the database." ["params"]=> array(1) { [0]=> array(2) { ["name"]=> string(4) "item" ["type"]=> array(3) { [0]=> array(3) { ["additionalProperties"]=> bool(false) ["properties"]=> array(2) { ["playlistid"]=> array(2) { ["$ref"]=> string(11) "Playlist.Id" ["required"]=> bool(true) } ["position"]=> array(2) { ["$ref"]=> string(17) "Playlist.Position" ["default"]=> int(0) } } ["type"]=> string(6) "object" } [1]=> array(1) { ["$ref"]=> string(13) "Playlist.Item" } [2]=> array(3) { ["additionalProperties"]=> bool(false) ["properties"]=> array(3) { ["path"]=> array(2) { ["required"]=> bool(true) ["type"]=> string(6) "string" } ["random"]=> array(2) { ["default"]=> bool(true) ["type"]=> string(7) "boolean" } ["recursive"]=> array(2) { ["default"]=> bool(true) ["type"]=> string(7) "boolean" } } ["type"]=> string(6) "object" } } } } ["returns"]=> array(1) { ["type"]=> string(6) "string" } ["type"]=> string(6) "method" }
Playe

And

[ code ]
$response = $rpc->Player->Open(array('file' => '/home/media/anything_else.avi'));
[ code ]

gives me

PHP Fatal error: Uncaught exception 'XBMC_RPC_ResponseException' with message 'Invalid params.' in xbmc-php-rpc-master\rpc\Response.php:27
Stack trace:
#0 \rpc\Client.php(320): XBMC_RPC_Response->__construct('{"error":{"code...')
#1 \rpc\Client.php(96): XBMC_RPC_Client->sendRpc('Player.Open', Array)
#2 \rpc\Command.php(63): XBMC_RPC_Client->executeCommand(Object(XBMC_RPC_Command))
#3 \rpc\Namespace.php(79): XBMC_RPC_Command->execute(Array)
#4 xbmc.php(65): XBMC_RPC_Namespace->__call('Open', Array)
#5 xbmc.php(65): XBMC_RPC_Namespace->Open(Array)
#6 {main}
thrown in xbmc-php-rpc-master\rpc\Response.php on line 2
7
find quote
Post Reply