Simple python module that allow xbmc full control over HTTP Json API.

jcsaaddupuy jcsaaddupuy Last update: Jul 23, 2022

Python VersionsWheel statusLicenceTraviscodecov

Deprecated. Code moved to https://github.com/jcsaaddupuy/python-kodijson

python xbmc json client

Simple python module that allow xbmc control over HTTP Json API.Virtually support all availables commands.

Install it :

pip install xbmc-json

Usages examples :

Client instanciation

from xbmcjson import XBMC, PLAYER_VIDEO#Login with default xbmc/xbmc credentialsxbmc = XBMC("http://YOURHOST/jsonrpc")#Login with custom credentialsxbmc = XBMC("http://YOURHOST/jsonrpc", "login", "password")

Ping XBMC

print xbmc.JSONRPC.Ping()

UI interaction :

# Navigate throught windowsxbmc.GUI.ActivateWindow({"window":"home"})xbmc.GUI.ActivateWindow({"window":"weather"})# Show some notifiations :xbmc.GUI.ShowNotification({"title":"Title", "message":"Hello notif"})# ...and so on

Parameters can alos be passed as python parameters:

xbmc.GUI.ActivateWindow(window="home")xbmc.GUI.ActivateWindow(window="weather")xbmc.GUI.ShowNotification(title="Title", message = "Hello notif")

Library interaction :

xbmc.VideoLibrary.Scan()xbmc.VideoLibrary.Clean()# ...and so on

Everything to build a script thats act as a full remote

xbmc.Application.SetMute({"mute":True})xbmc.Player.PlayPause([PLAYER_VIDEO])xbmc.Player.Stop([PLAYER_VIDEO])xbmc.Input.Left()xbmc.Input.Right()xbmc.Input.Up()xbmc.Input.Down()xbmc.Input.Back()xbmc.Input.Down()xbmc.Input.Info()# ...and so on

See http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v6 for availables commands.

Every XBMC namespaces are accessible from the instanciated xbmc client.

Every commands presents in the API documentation should be available.

You can take a look at xbmc-client for an implementation example.

Contribute

Please make your PR on the branch develop :)

Tags:

Subscribe to our newsletter