"destruk" wrote:
Having it load 2000 videos, images, and data for a single selection screen sounds like too much to me.
Actually, as it turns out, the delay was on the API side not on the Roku side, using xml text files everything loads much faster. The parsing is still on the order of 900 milleseconds, but that isn't too bad. Maybe there's a faster way, as KBenson suggested, one second to parse is a long time, if so, please let me know. Here's my code:
function parsexml(xmlxfer as string) as object
timer=createobject("rotimespan")
timer.mark()
xml=createobject("RoXMLElement")
posterlist=createobject("roArray",1,true)
if xml.parse(xmlxfer) then
if xml.channel.item.count() <1 then
?"no vids in this channel"
return [{Title:"",ShortDescriptionLine1:"No Content",SDPosterURL:"pkg:/images/blank.png",HDPosterURL:"pkg:/images/blank.png",url:"",action:""}]
end if
for each vid in xml.channel.item
group=vid.GetNamedElements("media:group")
content=group.getnamedElements("media:content")
tempitem=(GetVideoDataFromXML(vid))
posterlist.push(tempitem)
next
end if
?"XML Parse Time"; timer.totalseconds()
return posterlist
end function
function GetVideoDataFromXML(video) as object
vidposters=createobject("roarray",1,true)
posterobj=createobject("roassociativearray")
media=createobject("roassociativearray")
mediaArray=createobject("roArray",1,true)
group=video.GetNamedElements("media:group")
content=group.getnamedElements("media:content")
posterobj.Title=video.GetNamedElements("title").gettext()
posterobj.description=video.GetNamedElements("description").gettext()
posterobj.pubdate=video.GetNamedElements("pubdate").GetText()
posterobj.video=content 'mediaArray
posterobj.SDPosterURL=video.GetNamedElements("media:thumbnail")@url
posterobj.HDPosterURL=posterobj.SDPosterURL
posterobj.Action="details"
posterobj.ContentType="episode"
posterobj.ShortDescriptionLine1=posterobj.Title
posterobj.ShortDescriptionLine2=posterobj.Description
'if posterobj.description=""
' posterobj.description=posterobj.ShortDescriptionLine1
'end if
return posterobj
end function
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!