2005-10-30, 00:21
i have a script who automaticly restart in 10 secunds
what i have to change in the script to restart everday at the time 23:00?
#!python
# imports
import xbmc,xbmcgui
from time import *
#initial stuff
#dialog = xbmcgui.dialog()
pdialog = xbmcgui.dialogprogress()
sleeptime = 1
shutdowntime = 0
doit = 0
# defs #
#show the dialog to select shutdown timer
def showtimesdialog():
global sleeptime
global shutdowntime
if sleeptime > 0: shutdowntime = mktime(localtime())+sleeptime
#waits.... and finally shut down the box
def doshutdown():
global sleeptime
global doit
global shutdowntime
xbmc.output("it's "+asctime(localtime())+"\n")
xbmc.output("shutdown at "+asctime(localtime(shutdowntime))+"\n")
while sleeptime > 0:
sleep(1)
if (mktime(localtime()) > shutdowntime-11) and doit == 0:
doit = 1
xbmc.player().stop()
pdialog.create('mf1plus box ausschalten','mf1plus box wird heruntergefahren.')
sleeptime = 10
if doit == 1:
pdialog.update(100/10*(sleeptime-2))
if pdialog.iscanceled():
doit = 0
pdialog.close()
sleeptime = 0
sleeptime -= 1
if doit == 1:
pdialog.close()
xbmc.restart()
#main
def main():
showtimesdialog()
doshutdown()
main()
what i have to change in the script to restart everday at the time 23:00?
#!python
# imports
import xbmc,xbmcgui
from time import *
#initial stuff
#dialog = xbmcgui.dialog()
pdialog = xbmcgui.dialogprogress()
sleeptime = 1
shutdowntime = 0
doit = 0
# defs #
#show the dialog to select shutdown timer
def showtimesdialog():
global sleeptime
global shutdowntime
if sleeptime > 0: shutdowntime = mktime(localtime())+sleeptime
#waits.... and finally shut down the box
def doshutdown():
global sleeptime
global doit
global shutdowntime
xbmc.output("it's "+asctime(localtime())+"\n")
xbmc.output("shutdown at "+asctime(localtime(shutdowntime))+"\n")
while sleeptime > 0:
sleep(1)
if (mktime(localtime()) > shutdowntime-11) and doit == 0:
doit = 1
xbmc.player().stop()
pdialog.create('mf1plus box ausschalten','mf1plus box wird heruntergefahren.')
sleeptime = 10
if doit == 1:
pdialog.update(100/10*(sleeptime-2))
if pdialog.iscanceled():
doit = 0
pdialog.close()
sleeptime = 0
sleeptime -= 1
if doit == 1:
pdialog.close()
xbmc.restart()
#main
def main():
showtimesdialog()
doshutdown()
main()