If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

First Channel Issue

jnymrisjnymris Posts: 5Members, Plex Pass Plex Pass

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

Best Answer

Answers

Sign In or Register to comment.