Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
hugetv
Visitor

Re: help roGridScreen fast open

I still have the same problem it takes to load all the movies as I can make faster progress
Our system http://www.rokumanager.com
0 Kudos
hugetv
Visitor

Re: help roGridScreen fast open

and to have it load faster This is what I use to get content



Function InitShowFeedConnection(category As String) As Object

conn = CreateObject("roAssociativeArray")

conn.UrlPrefix = Url()
conn.UrlShowFeed = conn.UrlPrefix + "/movies.php?cat="+spaceEscape(category)

conn.Timer = CreateObject("roTimespan")

conn.LoadShowFeed = load_show_feed
conn.ParseShowFeed = parse_show_feed
conn.InitFeedItem = init_show_feed_item

print "created feed connection for " + conn.UrlShowFeed
return conn

End Function


'******************************************************
'Initialize a new feed object
'******************************************************
Function newShowFeed() As Object

o = CreateObject("roArray", 100, true)
return o

End Function


'***********************************************************
' Initialize a ShowFeedItem. This sets the default values
' for everything. The data in the actual feed is sometimes
' sparse, so these will be the default values unless they
' are overridden while parsing the actual game data
'***********************************************************
Function init_show_feed_item() As Object
o = CreateObject("roAssociativeArray")

o.ContentId = ""
o.Title = ""
o.ContentType = ""
o.ContentQuality = ""
o.Synopsis = ""
o.Genre = ""
o.Runtime = ""
o.Rating = ""
o.StreamQualities = CreateObject("roArray", 5, true)
o.StreamBitrates = CreateObject("roArray", 5, true)
o.StreamUrls = CreateObject("roArray", 5, true)

return o
End Function


'*************************************************************
'** Grab and load a show detail feed. The url we are fetching
'** is specified as part of the category provided during
'** initialization. This feed provides a list of all shows
'** with details for the given category feed.
'*********************************************************
Function load_show_feed(conn As Object) As Dynamic

if validateParam(conn, "roAssociativeArray", "load_show_feed") = false return invalid

print "url: " + conn.UrlShowFeed
http = NewHttp(conn.UrlShowFeed)

m.Timer.Mark()
rsp = http.GetToStringWithRetry()
print "Request Time: " + itostr(m.Timer.TotalMilliseconds())

response = ParseJson(rsp)

feed = newShowFeed()
m.Timer.Mark()
m.ParseShowFeed(response.posts, feed)
print "Show Feed Parse Took : " + itostr(m.Timer.TotalMilliseconds())

return feed

End Function


'**************************************************************************
'**************************************************************************
Function parse_show_feed(posts As Object, feed As Object) As Void

showCount = 0

for each curShow in posts

item = init_show_feed_item()

'fetch all values from the xml for the current show
item.ContentId = curShow.ContentId
item.ContentType = "episode"
item.Title = curShow.Title
item.Description = curShow.Description
item.Length = curShow.Length
item.Rating = curShow.Rating
item.StarRating = curShow.StarRating
item.Categories = curShow.Categories
item.Director = curShow.Director
item.Actors = curShow.Actors
item.ReleaseDate = curShow.ReleaseDate
item.StreamFormat = curShow.StreamFormat
item.StreamBitrates = curShow.StreamBitrates
item.StreamUrl = curShow.StreamUrl
item.SubtitleUrl = curShow.SubtitleUrl

item.StreamQualities = curShow.StreamQualities

item.HDPosterUrl = curShow.HDPosterUrl
item.SDPosterUrl = curShow.SDPosterUrl

'Set Default screen values for items not in feed
item.HDBranded = curShow.SubtitleUrl
item.IsHD = curShow.SubtitleUrl
item.fullHD = curShow.fullHD
item.Categories = curShow.Categories
item.Actors = curShow.Actors
item.Director = curShow.Director

showCount = showCount + 1
feed.Push(item)

skipitem:

next

End Function

Our system http://www.rokumanager.com
0 Kudos
hugetv
Visitor

Re: help roGridScreen fast open

"TheEndless" wrote:
It's not entirely clear what you're asking. The GridScreen will open as soon as you call screen.show(). In your code, you're not calling screen.show() until after you've loaded the data. If you call screen.show() immediately after calling screen.setListNames(categoryList), it might do what you asking, but the speed of the show will still be dependent on how long your getCategoryListMovies() takes.



how to make speed the getCategoryListMovies() is fast
Our system http://www.rokumanager.com
0 Kudos
TheEndless
Channel Surfer

Re: help roGridScreen fast open

"hugetv" wrote:
"TheEndless" wrote:
It's not entirely clear what you're asking. The GridScreen will open as soon as you call screen.show(). In your code, you're not calling screen.show() until after you've loaded the data. If you call screen.show() immediately after calling screen.setListNames(categoryList), it might do what you asking, but the speed of the show will still be dependent on how long your getCategoryListMovies() takes.

how to make speed the getCategoryListMovies() is fast

You'll probably need to address that on the server side. Building the list itself shouldn't be that bad on the Roku, so my guess is that it's the request to the server that's taking the longest time.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
hugetv
Visitor

Re: help roGridScreen fast open

I have on the server side a pager but not as part of roku do I have no idea
Our system http://www.rokumanager.com
0 Kudos