Log in

View Full Version : Dynamic content list


premkumar
April 29th, 2010, 01:53 PM
Hi,

I'm trying to build a small app to view content from a webpage that does not have have rss support. I've scrappers ready & able to login by posting params.

I dont see any example which manages a list with dynamic content. All the apps have contentURL set to rss. I need some examples for this. It would have been nice to have python class that I can derive & override to get content . -- something like

listitem.setContent(myContentClass)
myContentClass will have interface for next/prev/first last etc..

Also most examples have no onclick events specified for a list item. ..

Any info on this would be of great help
Thanks
prem

chad.socolovitch
April 29th, 2010, 02:17 PM
you can dynamically create a rss feed and then have the contentURL grab that.

if you need some help to create a RSS feed its pretty simple.

with some php/mysql knowledge you can create it pretty easy.

test your app grabbing a .rss feed and Zip it up and load here so we can test it.

and then i can show you how to have it grab a RSS feed you generate.

we can set the parameters to check the mysql DB by the following

1.) user
2.) users local time
3.) user permissions you set.


How often will it check the rss feed? Not sure but can this be made to check every say 30 minutes?

agentlame
April 29th, 2010, 02:26 PM
You can do this in Python:

<onload lang="python"><![CDATA[
mc.ShowDialogWait()

contentList = mc.GetActiveWindow().GetList(100)
itemList = mc.ListItems()
item = mc.ListItem( mc.ListItem.MEDIA_VIDEO_OTHER )

item.SetTitle('Test Item')

itemList.append(item)
contentList.SetItems(itemList)

mc.HideDialogWait()
]]></onload>


Here is a list of item properties:
http://developer.boxee.tv/Listitem_Class

premkumar
April 29th, 2010, 02:31 PM
Chad,

Php was what I'm trying to avoid. I'm familiar with php , that is not a problem. I've to have a webserver up & running just for this. I'm developing the app for my apple tv, which is already resource constrained. I dont want to have another machine running just because I want to watch TV. Both cases of browsing & search needs pagination , which would be simple with rss. The list controls seem to do pagination comfortably with rss .I'm just trying to see if I can implement it without rss.

This is another idea I had: spawning a python http server at app start.at a specific port which would serve me the rss with params I give it. But from the boxee docs , I was not sure how long the server can be kept running & when it would shutdown. It would be nice if Boxee provided a framework for that.

premkumar
April 29th, 2010, 02:35 PM
You can do this in Python:

<onload lang="python"><![CDATA[
mc.ShowDialogWait()

contentList = mc.GetActiveWindow().GetList(100)
itemList = mc.ListItems()
item = mc.ListItem( mc.ListItem.MEDIA_VIDEO_OTHER )

item.SetTitle('Test Item')

itemList.append(item)
contentList.SetItems(itemList)

mc.HideDialogWait()
]]></onload>


Here is a list of item properties:
http://developer.boxee.tv/Listitem_Class
agentlame,

i understand the simple case of adding one item to the list. The web page I'm scrapping is paginated. at onload , I'll grab the first page.I want to fetch the second page only if I need to( say I'm scrolling & out of items to be displayed) . Which call event should I need to define for this.

agentlame
April 29th, 2010, 02:38 PM
agentlame,

i understand the simple case of adding one item to the list. The web page I'm scrapping is paginated. at onload , I'll grab the first page.I want to fetch the second page only if I need to( say I'm scrolling & out of items to be displayed) . Which call event should I need to define for this.

Something like this should work:

<ondown lang="python"><![CDATA[
if len(itemList) == contentList.GetFocusedItem():
populate_next_page() #method that gets next page and populates list.
]]></onload>


You would put this in the <ondown> of your list control.

chad.socolovitch
April 29th, 2010, 03:22 PM
ahh sorry i thought you were using a certain website cause you mentioned Login.


my bad

premkumar
April 29th, 2010, 03:31 PM
Something like this should work:

<ondown lang="python"><![CDATA[
if len(itemList) == contentList.GetFocusedItem():
populate_next_page() #method that gets next page and populates list.
]]></onload>


You would put this in the <ondown> of your list control.
This is nice . I'll work on it today ...

agentlame
April 30th, 2010, 09:02 AM
You know what, I'm a moron.

That <ondown> will not fire until you're at the end of your list--not on eash down press IN the list--so you should actually be fine with:

<ondown lang="python"><![CDATA[
populate_next_page() #method that gets next page and populates list.
]]></onload>

premkumar
May 3rd, 2010, 03:34 PM
I just added it to the ondown of the panel , which fires when I'm at the last row & click down. Works fine . Soon I'ld like to emulate the same behaviour as one with rss. - where it preloads next set of results when you are at the last but one row.