Hi,
I’m currently making my first channel which Is going well. I’m able to pull the channels onto the first page. However I now want to moved channels onto a sub page using the mainmenu as a menu. Could someone point me in the right direction as to where I am going wrong?
Here is my working code: (The important bit)
@handler(PREFIX, TITLE, thumb=ICON, art=ART)
def MainMenu():
oc = ObjectContainer(title2=TITLE, no_cache=True)
xml = XML.ElementFromURL(XML_URL)
for node in xml[0][0]:
title = node.get('title')
thumb = node.get('hdposterurl')
#genrel = node.get('genrel')
url = node.get('url')
#ishd = node.get('ishd')
active = node.get('active')
if (active == 'true') or (active == '1'):
oc.add(
CreateVideoClipObject(
title=title, thumb=thumb, url=url
)
)
return oc
When I change it to the following It then fails to respond
@handler(PREFIX, TITLE)
def MainMenu():
oc = ObjectContainer()
oc.add(DirectoryObject(key=Callback(ChannelOpt1), title="Channel 1")))
return oc
@route(PREFIX +'/ChannelOpt1')
def ChannelOpt1()
oc = ObjectContainer(title2=TITLE, no_cache=True)
xml = XML.ElementFromURL(XML_URL)
for node in xml[0][0]:
title = node.get('title')
thumb = node.get('hdposterurl')
#genrel = node.get('genrel')
url = node.get('url')
#ishd = node.get('ishd')
active = node.get('active')
if (active == 'true') or (active == '1'):
oc.add(
CreateVideoClipObject(
title=title, thumb=thumb, url=url
)
)
return oc