Our forum migration to Discourse is underway and scheduled to last through June 21. During the migration, the forums will be read-only, except for a single temporary forum (contents of which will not be getting transferred). Read our announcement post for more information about the forum migration.
Hey folks, there is a new Podcast category for forums https://forums.plex.tv/categories/podcasts
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 Members, Plex Pass Posts: 7 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

  • czukowskiczukowski Members Posts: 162 ✭✭✭
    Accepted Answer

    @jnymris could be anything, better check the log files. If anything goes wrong, there'll always be an error message.

    I'm spotting a missing colon after def ChannelOpt1().

Answers

  • czukowskiczukowski Members Posts: 162 ✭✭✭
    Accepted Answer

    @jnymris could be anything, better check the log files. If anything goes wrong, there'll always be an error message.

    I'm spotting a missing colon after def ChannelOpt1().

Sign In or Register to comment.