import xbmc,xbmcgui
import subprocess,os, urllib2

class MyPlayer(xbmc.Player) :
    
    def __init__ (self):
        xbmc.Player.__init__(self)
    
    def onPlayBackPaused(self):
        if xbmc.Player().isPlayingVideo():
            urllib2.urlopen('http://fritz.box:8083/fhem?cmd.milight=set%20milight%20on&room=all')

    
    def onPlayBackResumed(self):
        if xbmc.Player().isPlayingVideo():
           urllib2.urlopen('http://fritz.box:8083/fhem?cmd.milight=set%20milight%20off&room=all')

player=MyPlayer()

VIDEO = 0

while not xbmc.abortRequested:
    if xbmc.Player().isPlaying():
        if xbmc.Player().isPlayingVideo():
            VIDEO = 1
        else:
            VIDEO = 0
    xbmc.sleep(1000)