Kodi Community Forum
Does XBMC. functions work? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Does XBMC. functions work? (/showthread.php?tid=26475)



Does XBMC. functions work? - FlyveHest - 2007-05-21

Hi All,

I'm a complete XBMC script newbie, but have been scripting in a lot of other applications before (mostly mIRC)

Anyway, the problem is, I want to make a shutdown timer script, that can put XBMC to sleep after a certain amount of time.

Looking through the documentation, it would seem like using XBMC.AlarmClock with XBMC.ShutDown() as a parameter would solve this nicely, but I can't seem to get anything from XBMC to work at all.

I have tried copying some code from other scripts, and they run fine, so its not my XBMC install thats not working. (Which, btw, is the T3CH distribution from 2007-05-14)

A very simple test i've tried getting to run, and which simply will not

Code:
import xbmc

def Main():
    xbmc.Notification('Test','Test')

Main()

Can anyone explain why this doesnt work?

To get to do what I want (shutting down), i'm guessing the code should look something like this

Code:
import xbmc

def Main():
    xbmc.AlarmClock('shutdowntimer',xbmc.ShutDown())

Main()

Which, according to the docs, should prompt for the time in minutes before running the command.

A small addendum, if i just use xbmc.ShutDown() the XBox shuts down fine, when the script is run.


- jmarshall - 2007-05-22

http://www.xboxmediacenter.com/wiki/index.php?search=executebuiltin&go=Go

indicates that you should use:

xbmc.executebuilting("xbmc.alarmclock(etc. etc.)")

Cheers,
Jonathan


- FlyveHest - 2007-05-22

Ahh, hmm, i'm pretty sure I tried something like that, but i'll give it a go later on.

Anyway, I also discovered that if you press down/up when you are on the shutdown icon, you can to a timed shutdown, which is exactly what I want, so I don't actually need to script it myself Big Grin