Kodi Community Forum

Full Version: Kodipydent - a complete JSON-RPC client library for Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all!

I've been looking at this project for a while, and finally had some spare time this evening to sit down and do it.

Something that's been bugging me is how relatively verbose the JSON-RPC API is. It's also complicated enough to make it unattractive to early-stage programmers to fiddle with. I'm hoping to change that.

My most recent project is beekeeper, a Python library that takes in a JSON or JSON-isomorphic configuration and turns it into a complete object-oriented Python interface to a REST API without any additional code. Today, I'm releasing kodipydent, a library taking advantage of the biggest benefits of beekeeper, along with a little bit of code to make it sing in a JSON-RPC-compliant way.

You can check out the kodipydent codebase at https://github.com/haikuginger/kodipydent, or you can install it and start playing with it right away with pip:

Code:
pip install kodipydent

All you need to do is point kodipydent at your Kodi instance's IP address, and it'll take care of the rest, giving you a clean Pythonic API from any networked device. It looks like this:

Code:
my_instance = kodipydent.Kodi('192.168.1.1')

From there, you can make any JSON-RPC call in the appropriate namespace:

Code:
my_instance.VideoLibrary.GetMovies()

I'd love to hear any comments or suggestions you have to improve it, and will gladly take your bug reports on Github.
It can play an episode from his id?
I think i'll be using this with my post-processing scripts Smile