Solved Please Help - Parse error
#1
Hi All,

I would really appreciate some help, I have the following request:

Code:
json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Files.GetFileDetails", "params": { "file": "C:\\XBMC\\Sample-Data\\Films\\A Few Good Men (1992)\\A.Few.Good.Men.1992.mkv", "media": "video", "properties": ["playcount"] }}')

However I keep getting the error:

Code:
JSONRPC: Failed to parse '{ "jsonrpc": "2.0", "method": "Files.GetFileDetails", "params": { "file": "C:\XBMC\Sample-Data\Films\A Few Good Men (1992)\A.Few.Good.Men.1992.mkv", "media": "video", "properties": ["playcount"] }}'

And printing the return gives:

Code:
{"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}

I have to confess that I really do not know what I'm doing with regards to JSON - so a real beginner, I tried adding

Code:
, "id": 1

To the end of the request (other calls seemed to have that) - but still no luck!

Any tips and advice would be great!

Thanks

Rob
Reply
#2
I don't see anything specifically wrong with your request on a quick glance. Adding the "id": 1 will result in a response once your request is working. If you ommit it you won't get any response from JSON-RPC (except parse errors).
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
Oh looking at it again, did you try to send the JSON-RPC request without the single quotes surrounding it?
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#4
Thank you for taking a quick look - unfortunatly I have still failed to get this to work - very frustrating Undecided
Reply
#5
Just in case some-one else stumbles accross this post with a similar problem.

I just managed to track the problem down (Done a bit more JSON since the original post, and decided to revisit it). It is due to the directory separator in Windows, a quick hack to the following did return data:

Code:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Files.GetFileDetails", "params": {"file": "%s", "media": "video", "properties": [ "playcount" ]},"id": 1 }' % filename.replace("\\", "\\\\"))

Rob
Reply

Logout Mark Read Team Forum Stats Members Help
Please Help - Parse error0