2011-01-19, 19:42
... 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
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
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.
{ "jsonrpc": "2.0", "method": "JSONRPC.Ping", "id": 1 }
{"method": "JSONRPC.Ping", "id": 1, "jsonrpc": "2.0" }
topfs2 Wrote:This is deprecated and will be removed eventually..
Xeder, read the json specification. It is an object
Is exactly the same asCode:{ "jsonrpc": "2.0", "method": "JSONRPC.Ping", "id": 1 }
etc. You can switch around any of the members in the object.Code:{"method": "JSONRPC.Ping", "id": 1, "jsonrpc": "2.0" }
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.
Fiasco Wrote:How can external queries of the database be deprecated?
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?
jmarshall Wrote:We'll arbitrarily rearrange the tables :p
topfs2 Wrote:Because its silly and not sane at all to assume one table layout. Also its a giant security failure
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
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.
Fiasco Wrote:You lost me. How is it a giant security failure?
Fiasco Wrote:Yes, the table layout could change but tweaking a select statement is pretty straightforward.
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)
{"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"}