2009-08-23, 00:16
I'm running a logoff script with a goal of logging off the current user after x minutes of inactivity. It seems that xbmc.getGlobalIdleTime() increments when there is media playing. For example, if I start playing a movie, exactly 10 minutes into it the user is logged-off. Below is the script I'm using, followed by a debug log. I would appreciate any assistance. Thanks!
autoexec.py:
# idle time in minutes
IDLE_TIME_MIN = 10
s = 1
while s > 0:
# get idle time
it = xbmc.getGlobalIdleTime()
#calculate sleep time in msec
s = ((IDLE_TIME_MIN * 60) - it ) * 1000
# sleep
if (s > 0): xbmc.sleep(s)
# log off
xbmc.executebuiltin('System.LogOff')
Debug log:
http://pastebin.ubuntu.com/257757/
autoexec.py:
# idle time in minutes
IDLE_TIME_MIN = 10
s = 1
while s > 0:
# get idle time
it = xbmc.getGlobalIdleTime()
#calculate sleep time in msec
s = ((IDLE_TIME_MIN * 60) - it ) * 1000
# sleep
if (s > 0): xbmc.sleep(s)
# log off
xbmc.executebuiltin('System.LogOff')
Debug log:
http://pastebin.ubuntu.com/257757/