Windows need help with simple json-rpc script

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
KRA77 Offline
Senior Member
Posts: 192
Joined: Jul 2010
Reputation: 0
Post: #11
First thing I tried was simply removing the output option, but that didn't work, then I tried with %temp% and the result:

C:/Users/Kay/AppData/Local/Temp: Permission denied

Sad

Even running cmd in administrator mode gives same permission denied
find quote
KRA77 Offline
Senior Member
Posts: 192
Joined: Jul 2010
Reputation: 0
Post: #12
Finally got it to run with

wget -q -Oc:\users\kay\jsonrpc.log --header='Content-Type: application/json' --post-data='{"jsonrpc": "2.0", "method": "VideoLibrary.Scan"}' http://xbmc:xbmc@192.168.10.120:8050/jsonrpc

Unfortunatly it returns:

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

Tried adding a ID

wget -q -Oc:\users\kay\jsonrpc.log --header='Content-Type: application/json' --post-data='{"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": 1 }' http://xbmc:xbmc@192.168.10.120:8050/jsonrpc

Still same error...
(This post was last modified: 2012-05-12 19:41 by KRA77.)
find quote
HenryFord Online
Posting Freak
Posts: 1,000
Joined: Jan 2010
Reputation: 14
Post: #13
(2012-05-12 19:30)KRA77 Wrote:  C:/Users/Kay/AppData/Local/Temp: Permission denied
And that is a good thing. You cannot redirect the output to a folder, you have to specify a file.

However - this should fix your problem:
Code:
wget -q -Oc:\users\kay\jsonrpc.log --header='Content-Type: application/json' --post-data="{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\", \"id\":1}" http://xbmc:xbmc@192.168.10.120:8050/jsonrpc

Need help? Check out my XBMC Eden Guide. It contains full featured guides to Sickbeard and CouchPotato as well.

[Image: all-fanart.jpg]
(This post was last modified: 2012-05-13 09:19 by HenryFord.)
find quote
KRA77 Offline
Senior Member
Posts: 192
Joined: Jul 2010
Reputation: 0
Post: #14
success !!

Thanks for sticking with it, I kindo figured the spaces was making problems, didn't know how to solve it, thank you.

Now the tricky part doing a single file update, and not full library update.

I'm thinking of doing this with a batfile with filename arguments, so just hardcode the path in bat file, and use

%~nx1

as code inside that bat file do add filename to the code.

I though I could use VideoLibrary.OnUpdate for that, but looking into it, I'm not so sure anymore.
find quote
Mizaki Offline
Fan
Posts: 662
Joined: Apr 2011
Reputation: 12
Post: #15
I believe you can only update a specific path if you are using Frodo.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
KRA77 Offline
Senior Member
Posts: 192
Joined: Jul 2010
Reputation: 0
Post: #16
A spesific path would sure help a lot and be better than full library update. Do you know the jsonrpc call that must be used ?
find quote
HenryFord Online
Posting Freak
Posts: 1,000
Joined: Jan 2010
Reputation: 14
Post: #17
There is currently no such JSON-Call as far as I can tell. Also: There isn't one in Frodo either, at least not that I could see it.

Need help? Check out my XBMC Eden Guide. It contains full featured guides to Sickbeard and CouchPotato as well.

[Image: all-fanart.jpg]
find quote
Mizaki Offline
Fan
Posts: 662
Joined: Apr 2011
Reputation: 12
Post: #18
From Frodo:
Code:
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "description": "JSON-RPC API of XBMC",
        "id": "http://www.xbmc.org/jsonrpc/ServiceDescription.json",
        "methods": {
            "VideoLibrary.Scan": {
                "description": "Scans the video sources for new library items",
                "params": [
                    {
                        "default": "",
                        "name": "directory",
                        "type": "string"
                    }
                ],
                "returns": {
                    "type": "string"
                },
                "type": "method"
            }
        },
        "version": 5
    }
}
{ "jsonrpc": "2.0", "method": "JSONRPC.Introspect", "params": { "filter": { "id": "VideoLibrary.Scan", "type": "method" } }, "id": 1 }

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
HenryFord Online
Posting Freak
Posts: 1,000
Joined: Jan 2010
Reputation: 14
Post: #19
Yup, you're right - didn't call onto the specifics since VideoLibrary.Scan has been there before but without the parameters. So - yeah, only possible with Frodo then Smile

Need help? Check out my XBMC Eden Guide. It contains full featured guides to Sickbeard and CouchPotato as well.

[Image: all-fanart.jpg]
find quote
KRA77 Offline
Senior Member
Posts: 192
Joined: Jul 2010
Reputation: 0
Post: #20
Thanks for the help
find quote