2010-10-13, 17:29
This is probably a simple thing, but i just cant get there.
My script looks like this:
This turns off my screen if i'm idle for more than 5 minutes, and is not playing a video.
But as soon as the playback ends, it turns off the screen, how can i make it wait the 300 seconds after playback ends?
EDIT:
If any one cares, i found a solution:
My script looks like this:
Code:
IDLE = 0
while(1):
if xbmc.getGlobalIdleTime() > 300:
if (IDLE == 0) and (xbmc.Player().isPlaying() == 0):
IDLE = 1
os.system("irsend SEND_ONCE Samsung_BN59-00861A Power")
else:
IDLE = 0
xbmc.sleep(3000)
This turns off my screen if i'm idle for more than 5 minutes, and is not playing a video.
But as soon as the playback ends, it turns off the screen, how can i make it wait the 300 seconds after playback ends?
EDIT:
If any one cares, i found a solution:
Code:
IDLE = 0
DIDPLAY = 0
IDLETIME = 300
while(1):
if (xbmc.getGlobalIdleTime() > IDLETIME):
if (IDLE == 0) and (DIDPLAY == 0):
os.system("irsend SEND_ONCE Samsung_BN59-00861A Power")
IDLE = 1
elif(DIDPLAY == 1) and ((time.time() - lastcheck) > IDLETIME):
DIDPLAY = 0;
else:
IDLE = 0
if (xbmc.Player().isPlaying() == 1):
IDLE = 0
DIDPLAY = 1
lastcheck = time.time()
xbmc.sleep(3000)