Kodi Community Forum
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174)
+---- Thread: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC (/showthread.php?tid=68263)



- Tolriq - 2012-02-27

For currently playing, you can ask for totaltime and time to get those informations.


Videolibrary.Scan while already scanning - bradvido88 - 2012-02-27

I have a large video library and when I trigger an update on it, XBMC usually takes 3-5 minutes to finish scanning everything.
I am seeing a problem when I call Videolibrary.Scan when XBMC is already scanning. In fact, calling it seems to stop the current scan, which is counter-intuitive.

See debug log below. I first call it at 11:00:02. XBMC starts its scanning routine. Then I call it agan a second later at 11:00:03 and XBMC immediately stops its scanning and ends the update.

I'd recommend either a query method like VideoLibrary.IsCurrentlyUpdating so we can query the status.
Or at least the JSON-RPC interface should prevent Videolibrary.Scan when XBMC is already scanning, and not return "result":"OK" (like it currently does).

Code:
[b]11:00:02 T:8908   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": {}, "id": "1"}[/b]
11:00:02 T:8908   DEBUG: JSONRPC: Calling videolibrary.scan
11:00:03 T:5012   DEBUG: ------ Window Init (DialogVideoScan.xml) ------
11:00:03 T:5012    INFO: Loading skin file: DialogVideoScan.xml
11:00:03 T:12232   DEBUG: Thread VIDEO::CVideoInfoScanner start, auto delete: 0
11:00:03 T:12232  NOTICE: VideoInfoScanner: Starting scan ..
11:00:03 T:12232   DEBUG: VideoInfoScanner: Skipping dir 'smb://ONYX/Data-2tb/Videos/BluRays/' due to no change (fasthash)
11:00:03 T:12232   DEBUG: VideoInfoScanner: Skipping dir 'smb://ONYX/Data-2tb/Videos/DVDs/' due to no change (fasthash)
11:00:03 T:12232   DEBUG: VideoInfoScanner: Skipping dir 'smb://ONYX/Data-2tb/Videos/Movies/' due to no change
11:00:03 T:12232   DEBUG: VideoInfoScanner: Skipping dir 'smb://ONYX/Data-2tb/Videos/Movies/Knight and Day/' due to no change (fasthash)
11:00:03 T:12232   DEBUG: VideoInfoScanner: Skipping dir 'smb://ONYX/Data-2tb/Videos/Movies/The Other Guys/' due to no change (fasthash)
11:00:03 T:12232   DEBUG: VideoInfoScanner: Skipping dir 'smb://ONYX/Data/compressed/Movies/' due to no change (fasthash)
11:00:03 T:12232   DEBUG: VideoInfoScanner: Skipping dir 'smb://ONYX/Data/compressed/StreamingVideos/Movies/' due to no change (fasthash)
11:00:03 T:12232   DEBUG: VideoInfoScanner: No (new) information was found in dir smb://ONYX/Data/compressed/StreamingVideos/TV Shows/24/
11:00:03 T:12232   DEBUG: VideoInfoScanner: No (new) information was found in dir smb://ONYX/Data/compressed/StreamingVideos/TV Shows/30.Days/
11:00:03 T:12232   DEBUG: VideoInfoScanner: No (new) information was found in dir smb://ONYX/Data/compressed/StreamingVideos/TV Shows/30.Rock/
11:00:03 T:12232   DEBUG: VideoInfoScanner: No (new) information was found in dir smb://ONYX/Data/compressed/StreamingVideos/TV Shows/Alcatraz/
11:00:03 T:12232   DEBUG: VideoInfoScanner: No (new) information was found in dir smb://ONYX/Data/compressed/StreamingVideos/TV Shows/America/
11:00:03 T:12232   DEBUG: VideoInfoScanner: No (new) information was found in dir smb://ONYX/Data/compressed/StreamingVideos/TV Shows/Arrested.Development/
11:00:03 T:12232   DEBUG: VideoInfoScanner: No (new) information was found in dir smb://ONYX/Data/compressed/StreamingVideos/TV Shows/Battle.360/
11:00:03 T:12232   DEBUG: VideoInfoScanner: No (new) information was found in dir smb://ONYX/Data/compressed/StreamingVideos/TV Shows/Blue's.Clues/
[b]11:00:03 T:8908   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": {}, "id": "1"}
[/b]11:00:03 T:8908   DEBUG: JSONRPC: Calling videolibrary.scan
11:00:03 T:12232   DEBUG: VideoInfoScanner: No (new) information was found in dir smb://ONYX/Data/compressed/StreamingVideos/TV Shows/Bones/
11:00:03 T:12232  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:00
11:00:03 T:12232    INFO: Video scan was stopped or finished ... restoring FindRemoteThumbs

EDIT - It also would be nice to be able to trigger a "Scan for content" on a specific directory instead of having to update my entire library and scan thousands of folders when I just need one scanned.
Is there a trac ticket/feature request for this yet?


- Montellese - 2012-02-27

This has already been reported before. This is how the builtin command works that XBMC provides in all it's APIs like the skinning engine etc. A "isscanning" property might be considered though. Not sure if there already is a ticket for it.


- bradvido88 - 2012-02-27

Montellese Wrote:This has already been reported before. This is how the builtin command works that XBMC provides in all it's APIs like the skinning engine etc. A "isscanning" property might be considered though. Not sure if there already is a ticket for it.

OK, I understand this is a core XBMC issue instead of a JSON-RPC issue.

Maybe a smaller request would be to support specifying a specific directory to be scanned instead of the whole video library.

I know the XBMC built in command has the option to specify a directory
Code:
UpdateLibrary(database,[path])
It would sure be nice if the JSON-RPC VideoLibrary.Scan has an optional path parameter as well.

It would sure speed up scans for users with large libraries...


- Montellese - 2012-02-27

See https://github.com/Montellese/xbmc/commit/7f3f7359a1ad7a66779bf460ec9679f42ce79141 i.e. I have already implemented this a few weeks ago and it's waiting for Eden to be released and then I'll merge it into master.


- yallah - 2012-02-28

hi,

Is it possible via Json to put video in full screen or window inside template (like "tab" button)??


- Montellese - 2012-02-28

Currently not but I have already done the necessary coding for a GUI.SetFullscreen() method which will be available after Eden has been released.


- yallah - 2012-02-28

Montellese Wrote:Currently not but I have already done the necessary coding for a GUI.SetFullscreen() method which will be available after Eden has been released.

thxfor quick reply Wink


Determining if library is being scanned - tack - 2012-02-28

In Dharma, I was able to detect if XBMC was scanning the library by using the System.GetInfoBooleans method with params ["library.isscanning"]. I see that in Eden the method is now XBMC.GetInfoBooleans, but it's not accepting library.isscanning. It comes back with an "invalid type string received" error:

Code:
{"params": ["library.isscanning"], "jsonrpc": "2.0", "method": "XBMC.GetInfoBooleans", "id": 1}
{"error":{"code":-32602,"data":{"method":"XBMC.GetInfoBooleans","stack":{"message":"Invalid type string received","name":"booleans","type":"array"}},"message":"Invalid params."},"id":1,"jsonrpc":"2.0"}

It's not clear to me what the proper parameters should be now. Can someone point me in the right direction? Or perhaps with Eden there is a better way to determine if it's currently scanning the library?

Thanks!


- Montellese - 2012-02-28

Please take a look at the documentation in the wiki or at the output of JSONRPC.Introspect. It's very clearly written that the "params" object/array needs to contain an array of strings (named "booleans" in case you use parameters-by-name): http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v4#XBMC.GetInfoBooleans

So you're request needs to be
Code:
{"params": { "booleans": ["library.isscanning"] }, "jsonrpc": "2.0", "method": "XBMC.GetInfoBooleans", "id": 1}



- tack - 2012-02-28

Montellese Wrote:It's very clearly written that the "params" object/array needs to contain an array of strings (named "booleans" in case you use parameters-by-name):
Thanks Montellese. I should have expanded the JSON schema description where this is very clear. I didn't pay proper attention to the description of the interface changes.

In any case, the "JSON RPC: Important changes" thread says that XBMC.GetInfoBooleans is considered deprecated. Is there a non-deprecated way at this time to determine if the library is currently being scanned?

Thanks again.


- Montellese - 2012-02-28

No there isn't.


- tack - 2012-02-28

All right. While I have you, in case it's not already on your to-do list, I thought I'd mention that there are two things that keep me using the deprecated HTTP API which (from what I can tell) the JSON-RPC doesn't support yet:

1. XBMC.Notification via ExecBuiltIn
2. XBMC.updatelibrary via ExecBuiltIn -- I understand there is VideoLibrary.Scan, but I need the ability to specify a sub-path, whereas VideoLibrary.Scan does a full library scan.

Not urgent while the HTTP API exists, but I'd certainly not want the HTTP API to vanish before the JSON API exposes at least this functionality. Smile


- Montellese - 2012-02-28

I have already implemented both methods/changes, they are just waiting for Eden to get out of the door Wink


- yallah - 2012-02-29

Hi,

Little bug for Json PVR. Can't use it when some OSD is present. Working very well when i'm in full screen (not when i m in PVR screen ,EPG, or when tv video is in miniature when you are in home page...)

Thx