I have a Raspberry PI3 with latest OSMC and have been using it to watch movies/TV by connecting it to my television that supports CEC via HDMI. Therefore the television switches on and off automatically whenever I select a movie via my mobile phone on which I have installed Kore.
Now I want to connect a soundbar (Canton DM 55) directly via optical link to the raspberry PI3. The reason I dont want it to be connected to the television, is that when I select to listen to music via Kore, I dont want the television to turn on automatically, so Kodi should not send a signal via CEC whenever it starts to play music.
Therefore instead Kodi should output the audio directly to the soundbar, and this is the case for all medias, while Kodi should only signal to turn on the television via CEC when a movie/video is played.
After reading some more I found the following two interesting threads regarding this topic:
Does anyone know how I can rewrite those pythong scripts to only switch on the tv when video is played? And where do I have to store such a python script? I was thinking the following script would suffice:
import xbmc,xbmcgui
if xmbc.getCondVisibility('Player.HasVideo'):
print '===TRUE==='
xbmc.executebuiltin('CECActivateSource')