Hy,
you can manage PVR Channels with kodi JSON RPC functions …
Get PVR channel ID’s with a browser, use alltv or allradio:
http://your_kodi_ip:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "PVR.GetChannels", "params": {"channelgroupid": "alltv", "properties" :["uniqueid"]},"id": 1}
{"id":1,"jsonrpc":"2.0","result":{"channels":[{"channelid":564,"label":"ORF1 HD", ...
Test to open PVR channel ORF1 HD on kodi with a browser:
http://your_kodi_ip:8080/jsonrpc?request={"id":1,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"channelid":564}}}
Convert the JSON RPC to use it with sendHttpGetRequest() at [http://www.freeformatter.com/url-encoder.html]
rule "ORF1 HD"
when
Item kodi_orf1hd changed to ON
then
var String json = "%7B%22id%22%3A1%2C%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22Player.Open%22%2C%22params%22%3A%7B%22item%22%3A%7B%22channelid%22%3A564%7D%7D%7D"
sendHttpGetRequest("http://login:password@your_kodi_ip:8080/jsonrpc?request=" + json)
sendCommand(kodi_orf1hd, OFF)
end
Manage music playlists with kodi addon functions …
String kodi_open_media "Player Open Media" <kodi> {xbmc=">[#kodi|Player.Open]"}
sendCommand(kodi_open_media, "special://profile/playlists/music/SmartPlaylist.xsp")
sendCommand(kodi_open_media, "special://profile/playlists/music/Playlist.m3u")
… and skip next/previous, play/pause with kodi JSON RPC functions
http://your_kodi_ip:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Player.GoTo","id":1,"params":{"playerid":0,"to":"next"}}
http://your_kodi_ip:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Player.GoTo","id":1,"params":{"playerid":0,"to":"previous"}}
http://your_kodi_ip:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}
rule "Skip Next"
when
Item kodi_skip_next changed to ON
then
var String json = "%7B%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22Player.GoTo%22%2C%22id%22%3A1%2C%22params%22%3A%7B%22playerid%22%3A0%2C%22to%22%3A%22next%22%7D%7D"
sendHttpGetRequest("http://kodi:kodi@192.168.0.101:8080/jsonrpc?request=" + json)
sendCommand(kodi_skip_next, OFF)
end
rule "Skip Previous"
when
Item kodi_skip_previous changed to ON
then
var String json = "%7B%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22Player.GoTo%22%2C%22id%22%3A1%2C%22params%22%3A%7B%22playerid%22%3A0%2C%22to%22%3A%22previous%22%7D%7D"
sendHttpGetRequest("http://kodi:kodi@192.168.0.101:8080/jsonrpc?request=" + json)
sendCommand(kodi_skip_previous, OFF)
end
rule "Play/Pause"
when
Item kodi_play_pause changed to ON
then
var String json = "%7B%22jsonrpc%22%3A+%222.0%22%2C+%22method%22%3A+%22Player.PlayPause%22%2C+%22params%22%3A+%7B+%22playerid%22%3A+0+%7D%2C+%22id%22%3A+1%7D"
sendHttpGetRequest("http://kodi:kodi@192.168.0.101:8080/jsonrpc?request=" + json)
sendCommand(kodi_play_pause, OFF)
end
Hope this helps some of you