Start playing playlist script
#1
i've just been getting into python scripting for xbmc, and have written a good script to automatically load a playlist, shuffle it, and then start playing.
i load this script at start-up, so xbox starts playing music from a playlist at start-up.

i'm not sure where to publish these scripts, so if anyone can tell me, that would be great, but for now, i'll just put the code below:

import xbmc, xbmcgui

# playliststart
# start playing a playlist
# by scomal
# version 1.0

#set up the following parameters:
#################################
#playlist to load:
file = '[your filename here]'
#suffle playlist on load?:
shuffle = true
#display loading notice?:
dispload = true
#################################

pls = xbmc.playlist(0)

class myclass(xbmcgui.window):
def (self, id):
# begin setting up the gui
self.info = xbmcgui.controllabel(50,50,200,20,"loading playlist...","font13","0xffffffff")
self.addcontrol(self.info)
def clear(self):
self.info.setlabel("")
self.removecontrol(self.info)



#program starts here:
if dispload:
winid = xbmcgui.getcurrentwindowid()

win = myclass(winid)


win.show()

try:
pls.load(file)

if shuffle:
pls.shuffle()

xbmc.player().play()

except:
pass
if dispload:
currwin = xbmcgui.getcurrentwindowid()
while currwin <> winid:
sleep(1)
currwin = xbmcgui.getcurrentwindowid()
win.clear()
win.close()
Reply
#2
sorry - i've now realised there is a huge list of scripts at:
http://dwl.xboxmediacenter.de/index.p....tart=60
and that many have started a playlist in scripts before...

oh well - this version shows how to place a text label on the main window - mabey that will be useful to someone! Confused
Reply
#3
for sure it is interesting. i already had a look at a post explaining how to do that, but never tested. now i've got an example.
thx
Reply

Logout Mark Read Team Forum Stats Members Help
Start playing playlist script0