Library Update URL for JSON as HTTP API depreciated

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
sy278 Offline
Member
Posts: 53
Joined: Feb 2012
Reputation: 0
Post: #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
find quote
sy278 Offline
Member
Posts: 53
Joined: Feb 2012
Reputation: 0
Post: #2
bump
find quote
zosky Offline
Donor
Posts: 304
Joined: Dec 2008
Reputation: 1
Location: toronto. canada
Post: #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

eight xbmc devices mostly openElec
atom/ion | iphone4 | hpTouchPad | raspberryPI ...
central mySQL db ( +20TB NAS ) +maraschino +IRtoy.v2 +yatse
[Image: widget]
find quote
danmedhurst Offline
Fan
Posts: 385
Joined: Jul 2008
Reputation: 2
Post: #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"}

[Image: 993659535.png]
(This post was last modified: 2013-02-22 20:44 by danmedhurst.)
find quote
sereeds Offline
Junior Member
Posts: 1
Joined: Feb 2013
Reputation: 0
Post: #5
How can I update a specific directory of the video library.Confused

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??
find quote
pkscout Offline
Posting Freak
Posts: 1,041
Joined: Jan 2011
Reputation: 22
Location: Honolulu, HI
Post: #6
I think you need a comma after VideoLibrary.Scan instead of the colon.
find quote
Zernable Offline
Senior Member
Posts: 132
Joined: Jun 2011
Reputation: 5
Post: #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
find quote
k_zeon Offline
Senior Member
Posts: 217
Joined: Aug 2011
Reputation: 0
Post: #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
find quote
k_zeon Offline
Senior Member
Posts: 217
Joined: Aug 2011
Reputation: 0
Post: #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
find quote
akuiraz Offline
Member
Posts: 76
Joined: Apr 2010
Reputation: 0
Post: #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: widget]
find quote
zilexa Offline
Fan
Posts: 319
Joined: Nov 2008
Reputation: 0
Location: Amsterdam
Post: #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..
(This post was last modified: 2013-05-07 11:17 by zilexa.)
find quote
transcender Offline
Donor
Posts: 233
Joined: Mar 2010
Reputation: 2
Post: #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.
(This post was last modified: 2013-11-09 06:49 by transcender.)
find quote
finish.06 Offline
Junior Member
Posts: 22
Joined: Jan 2011
Reputation: 0
Location: Des Moines, IA
Post: #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
find quote