/
example.py
34 lines (30 loc) · 1.11 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/env/python
from xbmcjson import XBMC, PLAYER_VIDEO
if __name__ == "__main__":
xbmc = XBMC("http://YOURHOST/jsonrpc")
# JSON RPC
# Ping
print(xbmc.JSONRPC.Ping())
# Gui
xbmc.GUI.ActivateWindow({"window": "home"})
xbmc.GUI.ActivateWindow({"window": "weather"})
# Show a notification
xbmc.GUI.ShowNotification({"title": "Title", "message": "Hello notif"})
# Application
xbmc.Application.SetMute({"mute": True})
xbmc.Application.SetMute({"mute": False})
# Video library
xbmc.VideoLibrary.Scan()
xbmc.VideoLibrary.Clean()
# Query the video library
print(xbmc.VideoLibrary.GetTVShows({
"filter": {"field": "playcount", "operator": "is", "value": "0"},
"limits": {"start": 0, "end": 75},
"properties": ["art", "genre", "plot", "title", "originaltitle",
"year", "rating", "thumbnail", "playcount", "file",
"fanart"],
"sort": {"order": "ascending", "method": "label"}
}, id="libTvShows"))
# Player
xbmc.Player.PlayPause([PLAYER_VIDEO])
xbmc.Player.Stop([PLAYER_VIDEO])