Kodi Community Forum

Full Version: Question about pvr API
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I wonder if it is possible to query the pvr information, like channels and peg from my addon?

If it is, can you please share a code example of how to get a list of channels with information like: channel name, URL, icon etc.

... after searching, I managed to find the channels, but how do I get the URL that it runs, can someone someone assist?


Here is my code:

ret = json.loads(xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "PVR.GetChannelGroups", "params":{"channeltype":"tv"} }'))
channelgroups = ret['result']['channelgroups']
for channelgroup in channelgroups:
#Get Channels
ret = json.loads(xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "PVR.GetChannels", "params":{"channelgroupid" : ' + str(channelgroup['channelgroupid']) + '} }'))
channels = ret['result']['channels']
for channel in channels:
#Get Channel Details
ret = json.loads(xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "PVR.GetChannelDetails", "params":{"channelid" : ' + str(channel['channelid']) + '} }'))
utils.write_log('service', str(ret))Confused