HTTP-API update library ... how to w/JSON-RPC ?
#1
Hi Yall

I currently use a BASH script that watches some RSS feeds, downloads new EPs, puts them in the right folder & tells XMBC to update the library using this ... wget http://xbmc:8080/xbmcCmds/xbmcHttp?comma...rary(video,${TVdir}))

now that Dharma is officially released; three questions...
1: when the HTTP-API is removed, this will stop working ?
2: UpdateLibrary has the option to specify a DIR. this is no longer possible ?
3: how to call JSON-RPC's VideoLibrary.ScanForContent from the BASH script ?

any help would be appreciated
~zosky
rPi 2&3 | android phones | fireHD8 | linux | win10 + NFS NAS w/ mySQL + props to...
libreElecyatse, titan, AELflexGet, context.manageTags (a zosky original)
Reply
#2
have some sabnzbd postprocessing scripts also and would like to know, how i can manage to update the library using json-rpc.

thanks,
marv_el
Reply
#3
I now use the following two vbs scripts to auto update the library when sabnzbd is finished and it works great atm, but I also wonder how to script this with json rpc:
Code:
Set xmlhttp = CreateObject("msxml2.xmlhttp")

xmlhttp.Open "GET", "http://localhost:8888/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)", False
xmlhttp.Send

Set xmlhttp = Nothing

Code:
Set xmlhttp = CreateObject("msxml2.xmlhttp")

xmlhttp.Open "GET", "http://localhost:8888/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)", False
xmlhttp.Send

Set xmlhttp = Nothing
I've searched quite a bit and I get that you have to use POST and that XBMC always listens on port 9090, so I've tried this to make it work, but it does nothing:
Code:
Set xmlhttp = CreateObject("msxml2.xmlhttp")

xmlhttp.Open "POST", "http://localhost:9090/VideoLibrary.ScanForContent", False
xmlhttp.Send

MsgBox(xmlhttp.ResponseText)

Set xmlhttp = Nothing
Anybody got a clue what I am doing wrong here? (the MsgBox here is to see what error I get back, but it doesn't open)

EDIT: sorry, wrong place, this is Linux subforum.
Reply
#4
this thread doesn't seem to be getting any (useful) responses Sad

but google did point me to another solution using xbmc-send @ boshdirect.com)

for now im still using http://xbmc:8080/xbmcCmds...
until it stops working
rPi 2&3 | android phones | fireHD8 | linux | win10 + NFS NAS w/ mySQL + props to...
libreElecyatse, titan, AELflexGet, context.manageTags (a zosky original)
Reply
#5
Its been answered many times before

Code:
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.ScanForContent", "id": "mybash"}' -H 'content-type: application/json;'  http://IP:8080/jsonrpc

Should do it
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
#6
I don't know to much about curl or json for that matter, but that command gives me
Code:
"{"error":{"code":-32601,"message":"Method not found."},"id":"mybash","jsonrpc":"2.0"}"
running from terminal.
Reply
#7
the error sort of tells you what is wong... i don't remember where i read it, but the method was renamed.

change "VideoLibrary.ScanForContent" to "VideoLibrary.Scan"...the rest should be fine as is
rPi 2&3 | android phones | fireHD8 | linux | win10 + NFS NAS w/ mySQL + props to...
libreElecyatse, titan, AELflexGet, context.manageTags (a zosky original)
Reply
#8
(2011-02-11, 19:17)topfs2 Wrote: Its been answered many times before

Code:
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.ScanForContent", "id": "mybash"}' -H 'content-type: application/json;'  http://IP:8080/jsonrpc

Should do it

How do I use this as a URL saved as a favourite on a browser to initiate library update in the manner I did before where the favourite called:

http://192.168.0.21:8080/xbmcCmds/xbmcHt...ary(video)
Reply
#9
(2013-02-01, 17:53)sy278 Wrote:
(2011-02-11, 19:17)topfs2 Wrote: Its been answered many times before

Code:
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.ScanForContent", "id": "mybash"}' -H 'content-type: application/json;'  http://IP:8080/jsonrpc

Should do it

How do I use this as a URL saved as a favourite on a browser to initiate library update in the manner I did before where the favourite called:

http://192.168.0.21:8080/xbmcCmds/xbmcHt...ary(video)

like this :

http://192.168.1.64:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}
Reply
#10
(2013-02-22, 20:43)danmedhurst Wrote: like this :

http://192.168.1.64:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}


Perfect, this solved it, thanks!
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
HTTP-API update library ... how to w/JSON-RPC ?00
This forum uses Lukasz Tkacz MyBB addons.