2016-09-25, 03:05
(2016-09-19, 20:10)black_eagle Wrote: Get the available PVR channel groups
PHP Code:result=$( curl -s --data-binary '{"jsonrpc": "2.0", "method": "PVR.GetChannelGroups", "params": {"channeltype" : "tv"}, "id": 1 }' -H 'content-type: application/json;' http://$xbmcAddress:$xbmcPort/jsonrpc)
Use jq to get the channel group ID for 'All channels'. Note, you can change this for whatever channels tags you have set up.
PHP Code:groupid=$(echo $result | jq '.result.channelgroups[] | select(.label=="All channels") | .channelgroupid')
Get channel names and numbers for all channels in the group.
PHP Code:result=$( curl -s --data-binary '{"jsonrpc": "2.0", "method": "PVR.GetChannels", "params": {"channelgroupid" : '$groupid',"properties":["channel"]}, "id": 1 }' -H 'content-type: application/json;' http://$xbmcAddress:$xbmcPort/jsonrpc)
Start channel '$startchan' playing
PHP Code:result=$( curl -s --data-binary '{"jsonrpc": "2.0", "method": "Player.Open","params":{"item":{"channelid": '"$startchan"'}}, "id": 1}' -H 'content-type: application/json;' http://$xbmcAddress:$xbmcPort/jsonrpc)
Thanks Black Eagle
I'm new to Linux and Kodi and I am having trouble getting these to work! Here is how I have tested the commands I posted above. One was I used Chrome using the "Simple REST Client" option, and was able to get the strings I posted to show a result in a working Kodi machine that was set static and to port 8080. "I sent these in the form in which you see them posted" and got a result.
I have also used a program like Putty, called "Hercules" to send just the IP strings portion of the commands I'm testing to a Kodi test machine on a static IP and to port 9090 which from what I have read is an open TCP socket, and this has been one of the easiest options, I can open a TCP socket of an IP on a port of my choosing and hold it open while I send IP test strings without the http://IPaddress/port/ in front. Example:
PHP Code:
/jsonrpc?request={"jsonrpc":"2.0","method":"AudioLibrary.GetAlbums","params":{"properties":["playcount","artist","genre"],"limits":{"end":10,"start":0},"sort":{"order":"ascending","method":"album","ignorearticle":true}},"id":"libAlbums"} -- get Albums
So with that said I tried to test the portions that I'm seeing as the TCP command only, so no "http://ipaddress/port" Example, I cut and pasted this:
PHP Code:
result=$( curl -s --data-binary '{"jsonrpc": "2.0", "method": "PVR.GetChannels", "params": {"channelgroupid" : '$groupid',"properties":["channel"]}, "id": 1 }' -H 'content-type: application/json;'
As stated I'm new to Linux and Kodi and hope you can help walk me through these. I tend to poke and prod until I get things to work if you follow me! Thanks!