Accessing database from script
#1
Can anybody give me an example of how to get for instance a list of all the TV shows in a python script or a simple addon that I can look at to learn?
Reply
#2
You will want to look at the http://kodi.wiki/view/JSON-RPC_API to get a list of items in the library.
Reply
#3
I'm probably a complete idiot but I'm not really understanding it. Executejsonrpc is a method of xbmc, but how do I use it?
Reply
#4
(2015-05-16, 01:04)Tricky Wrote: I'm probably a complete idiot but I'm not really understanding it. Executejsonrpc is a method of xbmc, but how do I use it?

The sample below is from a previous post of mine to get a list of watched episodes. More examples are available at: http://kodi.wiki/view/JSON-RPC_API/Examples

Code:
import json
import xbmc

request = {"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": { "filter": {"field": "playcount", "operator": "greaterthan", "value": "0"}, "limits": { "start" : 0 }, "properties": ["playcount"], "sort": { "order": "ascending", "method": "label" } }, "id": "libTvShows"}
results = json.loads(xbmc.executeJSONRPC(json.dumps(request)))
Reply
#5
(2015-05-16, 01:34)curti Wrote:
(2015-05-16, 01:04)Tricky Wrote: I'm probably a complete idiot but I'm not really understanding it. Executejsonrpc is a method of xbmc, but how do I use it?

The sample below is from a previous post of mine to get a list of watched episodes. More examples are available at: http://kodi.wiki/view/JSON-RPC_API/Examples

Code:
import json
import xbmc

request = {"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": { "filter": {"field": "playcount", "operator": "greaterthan", "value": "0"}, "limits": { "start" : 0 }, "properties": ["playcount"], "sort": { "order": "ascending", "method": "label" } }, "id": "libTvShows"}
results = json.loads(xbmc.executeJSONRPC(json.dumps(request)))


Thank you very much for the help, worked like a charm!!
Reply
#6
What is the id:libTvShows for actually?
Reply

Logout Mark Read Team Forum Stats Members Help
Accessing database from script0