not really asking a question here, just a comment if anyone wants to discuss
seems like many apps do lots of unnecessary reloading of content from the net. Well, when you first start on an app and you've never done this type of xml based data retrieval programming before, thinking this out is probably not as high a priority as learning and writing the app. I'm contemplating how to bolt a caching system onto the top of my app so that stuff only gets reloaded from the net when requested the first time, or the app is first loaded. If you can imagine what the cumulative cost of hundreds or thousands of clients with a poor caching system is for a company like YouTube for instance, or Netflix you can imagine that at some point unnecessary reloading is costing a hugh amount of money, which someone is paying for somewhere...
I'm not talking about predictive caching, but just storing information locally and only reloading when necessary.
Some ideas off the top of my head:
Use a separate posterlist variable for each category on your poster screen. Storing each posterlist in an roArray means you can use msg.Getindex() of posterscreen to select the to select the already loaded Posterlist:
posterscreen=createObject("roPosterScreen")
listone=loadsearchitems() 'preload the title, description, URL's of searchItems
listtwo=loadfavoriteitems() 'same thing for favorite items
posterlist=[listone,listwo]
posterscreen.SetContentList(Posterlist[0])
port=CreateObject("roMessagePort")
posterscreen.SetPort(port)
posterscreen.show
while true
msg=wait(0,port)
if msg.isListFocused()
posterscreen.SetContentList(posterlist[msg.getIndex()]
end if
end while
There may be errors in the above, since I just wrote it off the top of my head, but maybe you get the idea of what I'm thinking of.
Some mechanism for determining when a user has requested to load the data for the first time and when they are trying to look at the same data again has to be worked out. That's what I'm thinking about now for my own app.
Now of course, That only covers caching xml and posteritems, not the artwork and data files that come over. Well, assuming the artwork files aren't that big, one could probably save that to local memory or USB if they have it, and reload it from there, of course, there would need to be some way to wipe it out, probably want to do that when the app is loaded or better, when the accumulated pile of files is greater than a certain amount, or older than a certain date. Something like
if imageAge <> tooOld then
ImageURl(index)="pkg:/images/temp/image"+index+".png"
else
imageURL(index)="http://servername.com/temp/image"+".png"
end if
to try to throw together a quickee example from the top of my head....
So any philosophical comments?
- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!