2004-10-18, 20:59
i have an xbox in my bedroom running xbmc, and sometimes i fell asleep watching something, or wanted music while i was falling asleep. not wanting to leave my xbox on all night i created a sleep timer script.
it's the first thing i've ever written in python, and it turned out to be really simple.
i know xbmc has a "shutdown after idle" setting, but if you're playing a long playlist i don't think it will work.
it's the first thing i've ever written in python, and it turned out to be really simple.
Quote:import xbmc, xbmcgui
import time;
action_previous_menu = 10
dialog = xbmcgui.dialog()
list = ['cancel','15','30','45','60','90']
selected = dialog.select('sleep timer (minutes)', list)
if selected != 0:
time.sleep(60.0 * float(list[selected]))
xbmc.shutdown()
i know xbmc has a "shutdown after idle" setting, but if you're playing a long playlist i don't think it will work.