Updated Scripting (markdown)

boudabass 2018-08-31 23:57:08 +02:00
parent 2d58718bdf
commit 3b5eb6cb8c

@ -4,26 +4,26 @@ If you wish to script this addon using an outside scheduler or script it can be
Python code:
```python
RunScript(script.Kodibackup,mode=backup)
RunScript(script.xbmcbackup,mode=backup)
```
JSON Request:
```
{ "jsonrpc": "2.0", "method": "Addons.ExecuteAddon","params":{"addonid":"script.Kodibackup","params":{"mode":"restore","archive":"000000000000"}}, "id": 1 }
{ "jsonrpc": "2.0", "method": "Addons.ExecuteAddon","params":{"addonid":"script.xbmcbackup","params":{"mode":"restore","archive":"000000000000"}}, "id": 1 }
```
There is also a windows parameter that can be used to check if Kodi Backup is running within a skin or from another program. It is attached to the home window, an example of using it would be the following:
```python
#kick off the Kodi backup
Kodi.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Addons.ExecuteAddon","params":{"addonid":"script.Kodibackup","params":{"mode":"backup"}}, "id": 1 }')
Kodi.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Addons.ExecuteAddon","params":{"addonid":"script.xbmcbackup","params":{"mode":"backup"}}, "id": 1 }')
#sleep for a few seconds to give it time to kick off
Kodi.sleep(10000)
window = Kodigui.Window(10000)
while (window.getProperty('script.Kodibackup.running') == 'true'):
while (window.getProperty('script.xbmcbackup.running') == 'true'):
#do something here, probably just sleep for a few seconds
Kodi.sleep(5000)