I'm writing an external Python script that calls the JSON methods to perform library maintenance tasks (refresh etc.)
Is there any way to batch library scans, for example I'd like to initiate the scan of two sub directories as a single batched request, eg.:
Code:
[
{"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": {"directory": "nfs://192.168.0.3/share/TV Serials/Arrow/Season 1"}, "id": 1},
{"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": {"directory": "nfs://192.168.0.3/share/TV Serials/The Big Bang Theory/Season 6"}, "id": 2}
]
and while I get the following responses:
Code:
[
{"jsonrpc": "2.0", "id": 1, "result": "OK"},
{"jsonrpc": "2.0", "id": 2, "result": "OK"}
]
the only directory that is scanned is that of the first request, the second scan request is not actioned at all (its simply ignored).
Alternatively, is it possible for a Python script to receive a notification indicating when a scan is complete, so that it can proceed with the next directory scan? I know there is the VideoLibrary.OnScanFinished notification but I'm yet to discover how I can use this from a Python script (is there an example anywhere? I appreciate I'll need some sort of web server/socket to listen for a response).
If receiving a notification is not possible, what about polling XBMC to determine when the scan has completed?
Failing all other alternatives, can a library scan be requested that completes synchronously (ie. the caller is blocked until the scan is complete) so that scans of individual directories can be performed sequentially?