Kodi Community Forum
HTTP-API update library ... how to w/JSON-RPC ? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: HTTP-API update library ... how to w/JSON-RPC ? (/showthread.php?tid=87959)



HTTP-API update library ... how to w/JSON-RPC ? - zosky - 2010-12-19

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?command=ExecBuiltIn(UpdateLibrary(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


- marv_el - 2010-12-20

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


- BigNoid - 2011-02-10

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.


- zosky - 2011-02-11

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


- topfs2 - 2011-02-11

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


RE: HTTP-API update library ... how to w/JSON-RPC ? - tigertailz - 2012-03-14

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.


RE: HTTP-API update library ... how to w/JSON-RPC ? - zosky - 2012-03-14

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


RE: - sy278 - 2013-02-01

(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/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)


RE: - danmedhurst - 2013-02-22

(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/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)

like this :

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


RE: - sy278 - 2013-02-27

(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!