I have written a script that is designed to load when you start your xbox, it gets a list of your music playlists then lets you select which one to load, shuffle and play, then the script exits. What I need is for the script to automatically select the highlighted playlist if there is no user input for 10 seconds. Been working on it for 3 days, no luck. Help.

import os, xbmc, xbmcgui, time
try: Emulating = xbmcgui.Emulating
except: Emulating = False

#get actioncodes from keymap.xml
ACTION_PREVIOUS_MENU = 10

class MyClass(xbmcgui.Window):
def __init__(self):

if Emulating: xbmcgui.Window.__init__(self)
self.addControl(xbmcgui.ControlImage(0,0,720,480, "c:\\scripts\\background.jpg"))


# Make the List
self.list = xbmcgui.ControlList(290, 300, 150, 150)
self.addControl(self.list)

#Define Playlist Directory here
path = 'c:\\albums\\playlists\\'
list = os.listdir(path)
intcount = len(list)
for a in list :
self.list.addItem(a)
self.setFocus(self.list)

      def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()

def onControl(self, control):
if control == self.list:
item = self.list.getSelectedItem()
path1 = 'c:\\albums\\playlists\\'
xbmc.PlayList(0).load(path1+item.getLabel())
xbmc.PlayList(0).shuffle()
                       xbmc.Player().play()
self.close()

mydisplay = MyClass()
mydisplay.doModal()
del mydisplay


_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor

Reply via email to