2004-04-07, 18:07
# hi, i am trying to write a script that would auto execute upon xbmc's opening. this script will ask for a password, if the password doesn't equal that something, then xbmc will exit the program.
-----------------------------------------------------------
# imports
import xbmc,xbmcgui
from time import *
#initial stuff
dialog = xbmcgui.dialog()
pdialog = xbmcgui.dialogprogress()
sleeptime = 0
shutdowntime = 0
doit = 0
pwl = "
# defs #
def getuserinput():
pdialog.create('password','press cancel to enter password.')
pdialog.update(100/10)
if pdialog.iscanceled():
pdialog.close()
keyboard = xbmc.keyboard('')
keyboard.domodal()
if (keyboard.isconfirmed()):
return keyboard.gettext()
else:
return 0
pwl = getuserinput()
if pwl != "eminaz"
doit = 1
#waits.... and finally shut down the box
def doshutdown():
global doit
if doit == 1:
xbmc.player().stop()
pdialog.close()
xbmc.shutdown()
#main
def main():
showtimesdialog()
doshutdown()
main()
-------------------------------------------------
i didn't write all of that, to be honest. i borrowed some of the code from vultain and alx.
i don't know much about pything, but it is kind of like flash actionscripts, which i am experienced with.
-----------------------------------------------------------
# imports
import xbmc,xbmcgui
from time import *
#initial stuff
dialog = xbmcgui.dialog()
pdialog = xbmcgui.dialogprogress()
sleeptime = 0
shutdowntime = 0
doit = 0
pwl = "
# defs #
def getuserinput():
pdialog.create('password','press cancel to enter password.')
pdialog.update(100/10)
if pdialog.iscanceled():
pdialog.close()
keyboard = xbmc.keyboard('')
keyboard.domodal()
if (keyboard.isconfirmed()):
return keyboard.gettext()
else:
return 0
pwl = getuserinput()
if pwl != "eminaz"
doit = 1
#waits.... and finally shut down the box
def doshutdown():
global doit
if doit == 1:
xbmc.player().stop()
pdialog.close()
xbmc.shutdown()
#main
def main():
showtimesdialog()
doshutdown()
main()
-------------------------------------------------
i didn't write all of that, to be honest. i borrowed some of the code from vultain and alx.
i don't know much about pything, but it is kind of like flash actionscripts, which i am experienced with.