[kodi] feature request / PVR seperate media type for TV and RADIO

Hello out there,

I am using the new kodi binding with Kodi 18 to watch TV or listen to the radio with PVR IPTV Simple Client. In both cases the binding returns the value “channel” for channel “mediatype”. I am wondering if it is possible to split those return values to “channel” and “radio”.

I did some research and take a look at the log files. In case of TV Kodi returns this response:

2017-02-24 20:39:38.874 [DEBUG] [i.internal.protocol.KodiClientSocket] - Message received from server: {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"channeltype":"tv","id":120,"title":"(402) ZDF HD","type":"channel"},"player":{"playerid":1,"speed":1}},"sender":"xbmc"}}
2017-02-24 20:39:38.877 [DEBUG] [i.internal.protocol.KodiClientSocket] - Event received from server: {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"channeltype":"tv","id":120,"title":"(402) ZDF HD","type":"channel"},"player":{"playerid":1,"speed":1}},"sender":"xbmc"}}

2017-02-24 20:39:38.894 [DEBUG] [i.internal.protocol.KodiClientSocket] - send message: {"jsonrpc":"2.0","id":9029,"method":"Player.GetItem","params":{"playerid":1,"properties":["title","album","artist","director","thumbnail","file","fanart","showtitle","streamdetails"]}}
2017-02-24 20:39:38.906 [DEBUG] [i.internal.protocol.KodiClientSocket] - Message received from server: {"id":9029,"jsonrpc":"2.0","result":{"item":{"director":"","fanart":"","id":120,"label":"(402) ZDF HD","thumbnail":"image://https%3a%2f%2fdownload.avm.de%2ftv%2flogos%2fzdf_hd.png/","title":"Der Alte","type":"channel"}}}
2017-02-24 20:39:38.909 [DEBUG] [i.internal.protocol.KodiClientSocket] - Response received from server:{"id":9029,"jsonrpc":"2.0","result":{"item":{"director":"","fanart":"","id":120,"label":"(402) ZDF HD","thumbnail":"image://https%3a%2f%2fdownload.avm.de%2ftv%2flogos%2fzdf_hd.png/","title":"Der Alte","type":"channel"}}}
2017-02-24 20:39:38.941 [DEBUG] [i.internal.protocol.KodiClientSocket] - callMethod returns {"id":9029,"jsonrpc":"2.0","result":{"item":{"director":"","fanart":"","id":120,"label":"(402) ZDF HD","thumbnail":"image://https%3a%2f%2fdownload.avm.de%2ftv%2flogos%2fzdf_hd.png/","title":"Der Alte","type":"channel"}}}

In case of radio Kodi return this response:

2017-02-24 20:20:41.199 [DEBUG] [i.internal.protocol.KodiClientSocket] - Message received from server: {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"channeltype":"radio","id":73,"title":"Radio Herford","type":"channel"},"player":{"playerid":0,"speed":1}},"sender":"xbmc"}}
2017-02-24 20:20:41.203 [DEBUG] [i.internal.protocol.KodiClientSocket] - Event received from server: {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"channeltype":"radio","id":73,"title":"Radio Herford","type":"channel"},"player":{"playerid":0,"speed":1}},"sender":"xbmc"}}
2017-02-24 20:20:41.227 [DEBUG] [i.internal.protocol.KodiClientSocket] - send message: {"jsonrpc":"2.0","id":8919,"method":"Player.GetItem","params":{"playerid":0,"properties":["title","album","artist","director","thumbnail","file","fanart","showtitle","streamdetails"]}}
2017-02-24 20:20:41.262 [DEBUG] [i.internal.protocol.KodiClientSocket] - Message received from server: {"id":8919,"jsonrpc":"2.0","result":{"item":{"album":"","artist":["Radio Herford"],"fanart":"","id":73,"label":"Radio Herford","thumbnail":"image://https%3a%2f%2fwww.radioherford.de%2ffileadmin%2fams%2fShared%2fPublic%2fcustom%2fimg%2flogo-hf.png/","title":"","type":"channel"}}}
2017-02-24 20:20:41.265 [DEBUG] [i.internal.protocol.KodiClientSocket] - Response received from server:{"id":8919,"jsonrpc":"2.0","result":{"item":{"album":"","artist":["Radio Herford"],"fanart":"","id":73,"label":"Radio Herford","thumbnail":"image://https%3a%2f%2fwww.radioherford.de%2ffileadmin%2fams%2fShared%2fPublic%2fcustom%2fimg%2flogo-hf.png/","title":"","type":"channel"}}}
2017-02-24 20:20:41.267 [DEBUG] [i.internal.protocol.KodiClientSocket] - callMethod returns {"id":8919,"jsonrpc":"2.0","result":{"item":{"album":"","artist":["Radio Herford"],"fanart":"","id":73,"label":"Radio Herford","thumbnail":"image://https%3a%2f%2fwww.radioherford.de%2ffileadmin%2fams%2fShared%2fPublic%2fcustom%2fimg%2flogo-hf.png/","title":"","type":"channel"}}}

The channel “mediatype” of the binding returns the property “type”. There is another property called “channeltype”. May this be used to realize my requirement? What do you think?

//Edit: I think this feature is interesting because I want to sync my lights with Kodi. When I watch TV I want to dim them, when I listen to the radio I want them as they are.

Thanks for opinions.

Just in case someone is interested. I tried it on my own and I think it is working.

https://github.com/cweitkamp/openhab2-addons/tree/KodiPVRMediaTypeChannel