[4c653c]: script.advanced.wol / autostart.py  Maximize  Restore  History

Download this file

30 lines (27 with data), 958 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Wake-On-LAN
import xbmcaddon, sys, time
# Read Settings
settings = xbmcaddon.Addon( id="script.advanced.wol" )
autostart = settings.getSetting("autostart")
wolAfterStandby = settings.getSetting("wolAfterStandby")
wolDelayOnLaunch = int(settings.getSetting("wolDelayOnLaunch"))
wolDelayAfterStandby = int(settings.getSetting("wolDelayAfterStandby"))
if (autostart == "true"):
import default
if (wolDelayOnLaunch > 0):
xbmc.sleep(wolDelayOnLaunch*1000)
default.main(True)
if (wolAfterStandby == "true"):
print "script.advanced.wol: Waiting for resume from standby"
previousTime = time.time()
while (not xbmc.abortRequested):
if ( time.time()-previousTime > 5):
if (wolDelayAfterStandby > 0):
xbmc.sleep(wolDelayAfterStandby*1000)
print "script.advanced.wol: Start WOL script after return from standby"
default.main(True)
previousTime = time.time()
xbmc.sleep(1000)
else:
previousTime = time.time()
xbmc.sleep(1000)