json-rpckodi

How to get/set the "watched" status via Kodi's API?


I'm trying to write a lightweight wrapper on top of Kodi's JSON-RPC API (v10) using Python. I'm using the (so far very helpful) kodi-json module to do pretty much everything I need. For example, this will give me the title, position, and total (run time) for all episodes for tv show ID 111:

kodi.VideoLibrary.GetEpisodes(tvshowid=111, properties=["title", "resume"])

The problem I'm having is that I can't for the life of me figure out how to get (let alone set) the "watched" status of any episode or movie in the system. I know that it has to be there, since the normal UI I use on my Android set-top-box shows a little check mark next to all shows in a list.

The list of values I can pass to properties is long, but even when I specify every last one of the properties and print them all out, I can see no discernible difference between a show shown to be watched in the UI and one that isn't. Similarly, I have the same problem when using the GetEpisodeDetails call. I must be missing something.

Also note that there's no means for the user to see the UI, so the InputAction endpoints don't work for me either :-(

If someone could point me in the right direction, I'd appreciate it.


Solution

  • I don't know how I missed it, but playcount appears to be the property I'm looking for, and it's right there in the list of available properties:

    kodi.VideoLibrary.GetEpisodes(tvshowid=111, properties=["title", "playcount"])
    

    Even though it's called a count, it doesn't appear to increment with every time the video is played, but rather it's treated more like a boolean, 1 meaning "watched" and 0 meaning "unwatched".