Library Update URL for JSON as HTTP API depreciated
#1
Hi guys,

In Dharma and Eden I always used the below URL command from my web browser to initiate a library update:

192.168.0.21:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)



It seems that in Frodo that due to the HTTP API being replaced by the JSON one thatthis is no longer available, is there an equivalent I can use for Frodo?


Thanks
Reply
#2
bump
Reply
#3
from your browser ... go to the default webUI ... click remote ... click update library

from a command line ...
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "myScipt"}' -H 'content-type: application/json;' http://[IP-ADDRESS]:8080/jsonrpc
rPi 2&3 | android phones | fireHD8 | linux | win10 + NFS NAS w/ mySQL + props to...
libreElecyatse, titan, AELflexGet, context.manageTags (a zosky original)
Reply
#4
This will do it from a URL :

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

As a note, these are all the URl commands i've figured out so far :

List Movies
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "playcount", "operator": "is", "value": "0"}, "limits": { "start" : 0, "end": 75 }, "properties" : ["art", "rating", "thumbnail", "playcount", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}
Play File
http://192.168.1.66:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "smb://serveur/movie/movie.mkv" } }, "id": 1 }
Currently Playing
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}
Pause Currently Playing
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 1 }, "id": 1}
Update Library
http://192.168.1.64:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}
Reply
#5
How can I update a specific directory of the video library.Huh

I have done this many times with the old http API, but now with JSON it seems to only work for updating the entire library.
I prefer to not have all the hard disks on my NAS spin up when I just need to update the library for a specific path.

This does not work:
curl -v -H "Accept: application/json" -H "Content-type: application/json" -d '{"id":5,"jsonrpc":"2.0","method":"VideoLibrary.Scan:"params":{"directory":"smb://nas4free/files2/Movies/"}}' http://192.168.0.102/jsonrpc

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

Yes, I am able to update the entire library, but I really would like just a specific path, like I could before Frodo:
curl -sS --connect-timeout 2 "http://10.5.0.102/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video,smb://nas4free/files2/TV/showname/))"


According to the Frodo JSON API, it is possible, but doesn't seem to work.
5.12.22 VideoLibrary.Scan
Scans the video sources for new library items
Permissions:

UpdateData

Parameters:

[ string directory = "" ]

Returns: string


Any ideas??
Reply
#6
I think you need a comma after VideoLibrary.Scan instead of the colon.
Reply
#7
As pkscout pointed out, you have some syntax errors. You need to replace the : after VideoLibrary.Scan with a comma, and you are missing an end quote after VideoLibrary.Scan.

curl -v -H "Accept: application/json" -H "Content-type: application/json" -d '{"id":5,"jsonrpc":"2.0","method":"VideoLibrary.Scan","params":{"directory":"smb://nas4free/files2/Movies/"}}' http://192.168.0.102/jsonrpc
Reply
#8
(2013-02-22, 20:41)danmedhurst Wrote: This will do it from a URL :

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

As a note, these are all the URl commands i've figured out so far :

List Movies
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "playcount", "operator": "is", "value": "0"}, "limits": { "start" : 0, "end": 75 }, "properties" : ["art", "rating", "thumbnail", "playcount", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}
Play File
http://192.168.1.66:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "smb://serveur/movie/movie.mkv" } }, "id": 1 }
Currently Playing
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}
Pause Currently Playing
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 1 }, "id": 1}
Update Library
http://192.168.1.64:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}

This is great, I can now play a video file from pc to XBMC running Frodo. Do you also know the command to play a video file in Eden as i am running 2 different pods.

tks
Reply
#9
do you know how to play a Playlist.m3u file with

Play File
http://192.168.1.66:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "smb://serveur/movie/movie.mkv" } }, "id": 1 }

thanks
Reply
#10
Is it possible to Refresh a shows metadata from JSON-RPC? (like the TV Show Info dialog can do, refresh the shows metadata with the option to ignore local metadata and update using only internet)

I'm trying to find a faster way to rescrape all my shows using the latest tvdb.com metadata scraper and Frodo... I see that Frodo introduced some new fields that are scraped and saved to db (ie. episodes tvdb_id)... Thanks
Image
Reply
#11
(2013-02-23, 16:54)Zernable Wrote: As pkscout pointed out, you have some syntax errors. You need to replace the : after VideoLibrary.Scan with a comma, and you are missing an end quote after VideoLibrary.Scan.

curl -v -H "Accept: application/json" -H "Content-type: application/json" -d '{"id":5,"jsonrpc":"2.0","method":"VideoLibrary.Scan","params":{"directory":"smb://nas4free/files2/Movies/"}}' http://192.168.0.102/jsonrpc

@Zernable, thanks a lot for this information, I have been looking and testing a lot but couldn't figure this out.
I would like to use this json command to be run by Transmission after a torrent has finished downloading (Transmission "run script when done". I have not figured out yet how Transmission can give the directory path to the script (must be a parameter like $1 but now at least I have the full command. Thanks!

EDIT: just figured out, Transmission has parameter $TR_TORRENT_DIR available. Now I need to figure out how to run this command on XBian where curl is not available..
Reply
#12
can someone help?
I've managed to get the library scan to work when trying to update my old eden script to frodo but I can't get the notifications / msg sorted.
Running a windows batch file via Curl
%curlSRC%\curl.exe -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"GUI.ShowNotification\", "\params\":{"\title\":"testtitle","\message\":"TEST"}}" -H
content-type:application/json" http://user:pass@localhost:port/jsonrpc/jsonrpc

FIXED
%curlSRC%\curl.exe -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"GUI.ShowNotification\", \"params\":{\"title\":\"Auto Updater\",
\"message\":\"Updating...\"}}" -H "content-type:application/json" http://%XBMCu%:%XBMCp@%xbmcIP%:%XBMCwebport%/jsonrpc
Search first, provide details and keep forums clean. Mark things solved, to close them out and acknowledge helpful volunteers who share. If I have helped, click the plus button.
Reply
#13
(2013-02-22, 20:41)danmedhurst Wrote: This will do it from a URL :

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

As a note, these are all the URl commands i've figured out so far :

List Movies
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "playcount", "operator": "is", "value": "0"}, "limits": { "start" : 0, "end": 75 }, "properties" : ["art", "rating", "thumbnail", "playcount", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}
Play File
http://192.168.1.66:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "smb://serveur/movie/movie.mkv" } }, "id": 1 }
Currently Playing
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}
Pause Currently Playing
http://192.168.1.66:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 1 }, "id": 1}
Update Library
http://192.168.1.64:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}

These are very nice! Thank you! Can I ask where you started looking to understand how to write such http request? I looked at the jsonrpc wiki, but it doesn't even tell you to start with ... "jsonrpc?request="... where is a solid source that will really help guide me? Is it a combination of multiple sources?

Thanks!

Caleb
Reply
#14
Hi,

This command works on my windows box to update the whole library...

curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"AudioLibrary.Scan\", \"id\": \"mybash\"}" -H "content-type:application/json" http://xbmc:xbmc@localhost:8080/jsonrpc


However I would really like to add specific directories (smb://KUROSH-NAS/Kurosh-NAS/Kurosh/Music)...


curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"AudioLibrary.Scan\", \"params\": \"directory\"="smb://KUROSH-NAS/Kurosh-NAS/Kurosh/Music/", \"id\": \"mybash\"}" -H "content-type:application/json" http://xbmc:xbmc@localhost:8080/jsonrpc

...and this command doesn't work depite various rearranging of the syntax I cannot make it work. Please could someone help?
Reply
#15
try this:

curl -i -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\",\"params\": {\"directory\": \"smb://KUROSH-NAS/Kurosh-NAS/Kurosh/Music/\"}, \"id\": 1}" -H "content-type:application/json" http://xbmc:xbmc@localhost:8080/jsonrpc

with the params, you need the brackets {}.
also the = had to be replaced with :

Didn't really test it, could still be something wrong (or i added a mistake). good luck.
Check out my plugin yarc, it's a web-remote optimised for all screen sizes (especially touch and small screen).
Reply

Logout Mark Read Team Forum Stats Members Help
Library Update URL for JSON as HTTP API depreciated0