Play music without monitor/TV

Hello again,

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')

Thanks in advance