• 1
  • 43
  • 44
  • 45(current)
  • 46
  • 47
  • 226
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC
Star 
... if you're writing a regular expression bear in mind that the order of the fields can change... filename might not always be the first field you encounter
Reply
Aouch, I missed that. I'd suggest you looking at some of the many parsers for json out there already, why reinvent the wheel Smile
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
Do you mean JSON output from XBMC sometime exchange the fileds or the "client" exchenge them?

so far it has never happend, i think iviewer read the whole output then parse it from top to bottom.

@topfs2
save the ID variable somewhere in the memory is not possible in iviewer in a good way...
well I may endup having a parser server in the middle, but it feels clener to have ipad talk to XBMC by it self.

Regards
Reply
Xedar Wrote:Do you mean JSON output from XBMC sometime exchange the fileds or the "client" exchenge them?

so far it has never happend, i think iviewer read the whole output then parse it from top to bottom.

@topfs2
save the ID variable somewhere in the memory is not possible in iviewer in a good way...
well I may endup having a parser server in the middle, but it feels clener to have ipad talk to XBMC by it self.

Regards


JSON is a layer of crap you don't want for iViewer. Install an apache webserver and use Perl to query the xbmc databases directly. You can format your query responses in nice flat easily parseable delimited text.

In addition, xbmc doesn't have to be running to query.
Reply
Fiasco Wrote:JSON is a layer of crap you don't want for iViewer. Install an apache webserver and use Perl to query the xbmc databases directly. You can format your query responses in nice flat easily parseable delimited text.

In addition, xbmc doesn't have to be running to query.

This is deprecated and will be removed eventually..

Xeder, read the json specification. It is an object
Code:
{ "jsonrpc": "2.0", "method": "JSONRPC.Ping", "id": 1 }
Is exactly the same as
Code:
{"method": "JSONRPC.Ping", "id": 1,  "jsonrpc": "2.0" }
etc. You can switch around any of the members in the object.

And XBMC will always follow jsonrpc 2.0 specification, what you are suggesting is not technically in violation but it is real unnecessary and will never be added.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
i would like to initiate a video library scan from my client. Is there a way for my client to be notified when the scan is complete?
Reply
topfs2 Wrote:This is deprecated and will be removed eventually..

Xeder, read the json specification. It is an object
Code:
{ "jsonrpc": "2.0", "method": "JSONRPC.Ping", "id": 1 }
Is exactly the same as
Code:
{"method": "JSONRPC.Ping", "id": 1,  "jsonrpc": "2.0" }
etc. You can switch around any of the members in the object.

And XBMC will always follow jsonrpc 2.0 specification, what you are suggesting is not technically in violation but it is real unnecessary and will never be added.


How can external queries of the database be deprecated?
Reply
We'll arbitrarily rearrange the tables :p
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
Fiasco Wrote:How can external queries of the database be deprecated?

Because its silly and not sane at all to assume one table layout. Also its a giant security failure Smile
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
panos_k75 Wrote:i would like to initiate a video library scan from my client. Is there a way for my client to be notified when the scan is complete?

IIRC there is no way, please add a feature request ticket because its for sure a sane feature.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
jmarshall Wrote:We'll arbitrarily rearrange the tables :p

Bwahhahahahah touché!
Reply
topfs2 Wrote:Because its silly and not sane at all to assume one table layout. Also its a giant security failure Smile

You lost me. How is it a giant security failure?

Yes, the table layout could change but tweaking a select statement is pretty straightforward.
Reply
Xedar Wrote:Hi!

is there a way to get the id tag in every { } ?
when i parse the JSON i must use an } as EOM otherwise iam not able to fetch everything.
eg.

Best regards Mikael

JSON parsing from scratch IS difficult. My solution is probably going to be to give up on the raw socket interface and switch to HTTP, then you should only get a single response (or maybe limited number of responses) per request so it is easier to delineate messages, rather than an endless stream.

With no unique EOM, the socket interface seems like it has a high risk of getting out of sync if something gets mangled, even with a proper JSON parser. It will take a lot of extra code to protect against those issues.
Reply
wuench Wrote:JSON parsing from scratch IS difficult. My solution is probably going to be to give up on the raw socket interface and switch to HTTP, then you should only get a single response (or maybe limited number of responses) per request so it is easier to delineate messages, rather than an endless stream.

With no unique EOM, the socket interface seems like it has a high risk of getting out of sync if something gets mangled, even with a proper JSON parser. It will take a lot of extra code to protect against those issues.

TCP guarantees packet order and packet arrival, if it looses packets it will be resent and if it looses the entire stream it will give you a proper error for that. There exist proper stream parsers or you can use a proper jsonrpc client and it should work. That being said, http is usually simpler if you want to just use a parser.

Fiasco Wrote:You lost me. How is it a giant security failure?

Anyone having access to the database can both read, edit and completely destroy the database at a there leisure. This is something which is not at all good, something which should be sandboxed and impossible for a client to do unless explicitly allowed to do, which is what jsonrpc sets out the fix.

Fiasco Wrote:Yes, the table layout could change but tweaking a select statement is pretty straightforward.

It is, but why should a client need to do this at every release. i.e. it needs to first parse out what version XBMC is then it needs to create the select statement. XBMC handles this perfectly in the GUI code and a client should ideally be able to just ask "Get all movies" and the it should get them, no matter what version the database is. This is why jsonrpc is design how it is.

Cheers,
Tobias
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
Hey guys...

Super noob here...please be gentle...

I am trying a few things using the python script from the 1st page and i have 2 problems :

#1) When running the python script, it takes about 15 seconds before the urlopen executes... any idea why?

This is the source :

Code:
import json
import httplib, urllib
import sys

url = 'http://username:password@hostname:80'
jsonrpcurl = url + '/jsonrpc'

postdata = '{"jsonrpc": "2.0", "method": "VideoPlayer.SmallSkipForward", "id": "1"}'

print postdata

urllib.urlopen(jsonrpcurl, postdata)

#2) What is the proper syntax for VideoPlayer.SeekPercentage ? I have tried pretty much everything i can think of including :

Code:
{"jsonrpc": "2.0", "method": "VideoPlayer.SeekPercentage", "params": {"": "50"}, "id": "1"}

{"jsonrpc": "2.0", "method": "VideoPlayer.SeekPercentage", "params": {"": 50}, "id": "1"}

{"jsonrpc": "2.0", "method": "VideoPlayer.SeekPercentage", "params": {"parameter": "50"}, "id": "1"}

{"jsonrpc": "2.0", "method": "VideoPlayer.SeekPercentage", "params": [50], "id": "1"}

{"jsonrpc": "2.0", "method": "VideoPlayer.SeekPercentage", ["50"], "id": "1"}

Help! Big Grin
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
  • 1
  • 43
  • 44
  • 45(current)
  • 46
  • 47
  • 226

Logout Mark Read Team Forum Stats Members Help
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC8