Kodi.call_method help

Hi I am trying to use the kodi.call_method to retrieve stats on Movie/TV Shows total and then watched/unwatched.

I can see results with this call method

{"entity_id": "media_player.kodi", "method": "VideoLibrary.GetMovies"}

can someone help me with how to add filter parameters to get watched/unwatched values?

Not without an example of the returned results.

This call just returns the total movies in the library handy and one of the metrics I’m looking for.
image

Like the request below

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

Paste the returned json data into the left hand column here: http://jsonpathfinder.com/ (deleting the example data first).

Drill down in the right hand column until you get to the data you want. Paste the result in the top of the right hand column here and I’ll try to format it sensibly for HA if you need help.

The problem is it won’t be in the result as I have just asked for the total number of movies with the VideoLibrary,.GetMovies request. You can let Kodi do all the hard work by adding filters to get your desired array returned, like [playcount]. I just can’t tell how to structure it in the kodi.call_method

Ah I see. I thought you just wanted the returned result parsed.

1 Like