def getnodes(c): if len(c.nodes)!=len(c.items): c.dirty= True if not c.dirty: return c.nodes pl= vlc.playlist() c.nodes= [ int(i["id"]) for i in pl ] if len(c.nodes)>len(c.items): c.items= [ { 'title': i["name"], 'file': i["uri"] } for i in pl ] c.dirty= False return c.nodes
def position(c,currentplid=None,**o): print "currentplid:", currentplid print c.getnodes() if currentplid!=None: if currentplid in c.nodes: return c.getnodes().index(currentplid) else: pl= vlc.playlist() for i in pl: if i.get("current"): return pl.index(i) c.dirty= True return 0