2016-01-18, 03:51
I'm looking to run a service that detects when the screensaver activates after which commands will be executed. I'm not quite sure how to implement this, here's my attempt. Can anyone point out what I'm missing? I see the screensaver activation in the debug logging but the script isn't detecting it.
Code:
import time
import xbmc
if __name__ == '__main__':
monitor = xbmc.Monitor()
while not monitor.abortRequested():
xbmc.log("service.test heartbeat %s" % time.time(), level=xbmc.LOGDEBUG)
# Sleep/wait for abort for 10 seconds
if monitor.waitForAbort(10):
# Abort was requested while waiting. We should exit
break
def onScreensaverActivated(self):
xbmc.log("service.test screensaver activated %s" % time.time(), level=xbmc.LOGDEBUG)