Skip to content

Instantly share code, notes, and snippets.

@Michal-Szczepaniak
Created October 28, 2021 19:56
Show Gist options
  • Save Michal-Szczepaniak/e8d0d9eff7fa1ef2545397f214178014 to your computer and use it in GitHub Desktop.
Save Michal-Szczepaniak/e8d0d9eff7fa1ef2545397f214178014 to your computer and use it in GitHub Desktop.
import xbmc
from pywizlight import wizlight, PilotBuilder
class XBMCPlayer( xbmc.Player ):
def __init__(self, *args):
xbmc.Player.__init__(self)
xbmc.log('Kodi WiZ __init__')
def onPlayBackStarted( self ):
xbmc.log('Kodi WiZ playbackStarted')
light = wizlight("192.168.68.4")
asyncio.run(light.turn_off(PilotBuilder()))
def onPlayBackEnded( self ):
xbmc.log('Kodi WiZ playbackEnded')
light = wizlight("192.168.68.4")
asyncio.run(light.turn_on(PilotBuilder()))
def onPlayBackStopped( self ):
xbmc.log('Kodi WiZ playbackStopped')
light = wizlight("192.168.68.4")
asyncio.run(light.turn_off(PilotBuilder()))
def onPlayBackPaused(self):
xbmc.log('Kodi WiZ playbackPaused')
light = wizlight("192.168.68.4")
asyncio.run(light.turn_off(PilotBuilder()))
player = XBMCPlayer()
monitor = xbmc.Monitor()
while(not xbmc.Monitor.abortRequested):
if xbmc.Monitor.waitForAbort(1):
break
del player
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment