Results 1 to 6 of 6

Thread: Dynamic <content> URLs

  1. #1

    Default Dynamic <content> URLs

    I'm working on an app that delivers a different content URL to each user based on some authentication that takes place.

    Any thoughts/suggestions on how to do it?

    Code:
    <content url="SOMETHING DYNAMIC??">
    <onclick lang="python"><![CDATA[
    python.pythonsscript()
    ]]></onclick>
    </content>
    Any help/thoughts would be good.
    ~Kai
    Website: http://kaiarmstrong.com
    Twitter: @phikai
    Boxee Development: Think One Zero Boxee Development - Feel free to donate here to help support it!
    Twitter: @ThinkOneZero - Support/News/Updates/Statues about Think One Zero Services

  2. #2
    Join Date
    Nov 2010
    Location
    Jyväskylä, Finland
    Posts
    66

    Default

    I'm not sure if I understand what you're asking.. but you don't need to set content at all in skin xml, just do it in python after you've authenticated.

    If you have a list to populate, it's like this:

    list = mc.GetWindow(14000).GetList(100)
    itemList = mc.ListItems()

    #repeat the following in some loop
    item = mc.ListItem( mc.ListItem.MEDIA_UNKNOWN )
    item.SetPath("whatever")
    item.SetLabel("Whatever")
    #..and anything else you need to set on items
    itemList.append(item)

    #then finally..
    list.SetItems(itemList)

  3. #3

    Default

    Does that make the <content> tag in the XML part of the app optional? I don't need to even have it?
    ~Kai
    Website: http://kaiarmstrong.com
    Twitter: @phikai
    Boxee Development: Think One Zero Boxee Development - Feel free to donate here to help support it!
    Twitter: @ThinkOneZero - Support/News/Updates/Statues about Think One Zero Services

  4. #4
    Join Date
    Nov 2010
    Location
    Jyväskylä, Finland
    Posts
    66

    Default

    Quote Originally Posted by phikai View Post
    Does that make the <content> tag in the XML part of the app optional? I don't need to even have it?
    It's optional in the sense you can set content without it via python. But if you need custom onclick actions, that's where you set them.

    In my app (which uses the code in the above post) it's like this:

    Code:
                <content type="action">
                <onclick lang="python"><![CDATA[
    tb.load(14000)
    ]]></onclick>
                </content>
    tb is the my code module. I use the same "load" function for many windows and that's way the window id is parameter. I could probably have used some getactivewindow method in the code but this is the way I did it.

  5. #5

    Default

    Thanks for the help on this, really helped me figure it out. Now i'm having trouble getting my onclick to execute. It's just popping up the action dialog and doesn't seem to be doing anything with this block...

    I had a mc.LogDebug("test") at the top of this block just to see if that ever happened and it didn't...I'm wondering if it's some type of issue with the properties I've given the items...

    Code:
    <onclick lang="python"><![CDATA[
    list = mc.GetActiveWindow().GetList(100)
    listitems = list.GetItems()
    listitem = listitems[list.GetFocusedItem()]
    params = mc.Parameters()
    params["link"] = str(listitem.GetPath())
    params["isLocal"] = str(listitem.GetProperty("isLocal"))
    linktype = params["link"].split('://')
    if (linktype[0] == "rss"):
    	servers.doRootBrowse(httpPrefix(params["link"]), params["isLocal"])
    elif (linktype[0] == "browse"):
    	servers.doRootBrowse(httpPrefix(params["link"]), params["isLocal"])
    elif (linktype[0] == "folder"):
    	servers.doFolderBrowse(httpPrefix(params["link"]))
    else:
    	myTracker.trackEvent("Event", "Play", listitem.GetProperty("event"))
    	mc.GetPlayer().Play(listitem)
    ]]></onclick>
    I'm only setting a few properties for the items as this is a menu to then execute another Get request to build a new list of items...

    Code:
    					
    item = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN)
    item.SetProperty("isLocal", "false")
    item.SetPath(rssPrefix(str(ramp.externaluri.contents[0])))
    item.SetLabel(str(ramp.endpointname.contents[0]))
    item.SetThumbnail('server_thumb.png')
    Any thoughts on that would be great...
    ~Kai
    Website: http://kaiarmstrong.com
    Twitter: @phikai
    Boxee Development: Think One Zero Boxee Development - Feel free to donate here to help support it!
    Twitter: @ThinkOneZero - Support/News/Updates/Statues about Think One Zero Services

  6. #6

    Default

    Hmm...looks like it's cause I didn't specify "action" in my content tag is why this wasn't working properly.
    ~Kai
    Website: http://kaiarmstrong.com
    Twitter: @phikai
    Boxee Development: Think One Zero Boxee Development - Feel free to donate here to help support it!
    Twitter: @ThinkOneZero - Support/News/Updates/Statues about Think One Zero Services

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •