Notification when PVR channel is changed? - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: Notification when PVR channel is changed? (/showthread.php?tid=222101) |
Notification when PVR channel is changed? - owagner - 2015-03-22 Hi, I'm writing a small service addon which needs to get notification when playback state changes. Everything is generally working fine, with one exception: I fail to find a way how to detect switched PVR channels. I've subclassed xbmc.Player and do get proper notifications when I switch files, i.e. onPlayBackStarted() is called everytime a new file starts playing. However, this is not the case when I'm playing back Live TV (via the VNSI plugin in my case). onPlayBackStarted() is called the first time I start playing Live TV, but not upon a channel switch. It seems that actually none of the notification methods in Player is called on a channel switch. If I stop and restart Live TV playback, I get the expected notifications onPlayBackStopped and onPlayBackStarted. Am I overlooking something? Best Regards, Olli Version: Kodi (14.2-RC1 Git:20150311-e7ba06f). Platform: Windows NT x86 32-bit Full log from test run: http://pastebin.com/Mn2jvGiQ RE: Notification when PVR channel is changed? - enen92 - 2015-03-24 I think your best go is to find through the json rpc api which channel is playing, saving it and check the player state in timed intervals. If I recall correctly the id of the channel you're watching will change if the entry in the EPG is different so it might be a little hackish to accomplish that. I'll try to find a code snipped somewhere that can help you out RE: Notification when PVR channel is changed? - enen92 - 2015-03-24 Here is what I have on my backups. I'm pretty sure you can find some of the code here usefull. In this case it tries to find out the details of the channel being played in kodi and tries to match it against all the channels the user has on the pvr. Basically it finds the id of the item being payed and checks which channel has that id. I think you have to do that since the id of channel is not constant (depends on the epg entry of the channel). So for instance if you're watching the news on BBC 1 the id will be different from watching let's say a football match in BBC1. Code: #check if any player is active Hope this helps |