as I can make my roGrid Screen open fast
I’m using the code where you want to make open much faster
Sub showMoviesScreen()
dlg = CreateObject("roOneLineDialog")
dlg.setTitle("Loading Collection")
dlg.showBusyAnimation()
dlg.show()
screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.SetGridStyle("flat-portrait")
screen.SetDescriptionVisible(true)
screen.SetBreadcrumbText("Movies", "Session")
categoryList = getCategoryListMovies()
categoryCount = categoryList.count()
seriesList = CreateObject("roList")
screen.SetupLists(categoryCount)
screen.setListNames(categoryList)
for i = 0 to categoryCount-1
tmpMoviesList = getMoviesByCategory(categoryList[i])
screen.SetContentList(i,tmpMoviesList)
seriesList.AddTail(tmpMoviesList)
end for
screen.show()
dlg.close()
while true
msg = wait(10, port)
if msg <> invalid and type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed() then
exit while
else if msg.isListItemSelected() then
selection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]
if selection.Title = "Search"
searchMovies()
else if selection.Title = "Favorites"
FavoritesMovies()
else
showSpringboardScreenMovies(selection)
end if
end if
end if
end while
End Sub
Function getCategoryListMovies() as object
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/category.php?t=movie")
json = ParseJson(jsonAsString.GetToString())
return json
End Function
Function getMoviesByCategory(category)
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/movie.php?cat="+spaceEscape(category))
json = ParseJson(jsonAsString.GetToString())
return json.Videos
End Function
someone could help
could have someone to help me with this please
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.
“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.
and that I can do to get Movies Category List () to make it more Thin and care less data to enter
“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.and that I can do to get Movies Category List () to make it more Thin and care less data to enter
It’s possible, but that’s hard to say without knowing what it’s doing. Getting the category list, however, may not be that slow, so adding the screen.show() where I suggested above could still result in a much faster screen opening.
this
Sub showMoviesScreen()
dlg = CreateObject("roOneLineDialog")
dlg.setTitle("Loading Collection")
dlg.showBusyAnimation()
dlg.show()
screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.SetGridStyle("flat-portrait")
screen.SetDescriptionVisible(true)
screen.SetBreadcrumbText("Movies", "Session")
categoryList = getCategoryListMovies()
categoryCount = categoryList.count()
seriesList = CreateObject("roList")
screen.SetupLists(categoryCount)
screen.show()
screen.setListNames(categoryList)
for i = 0 to categoryCount-1
tmpMoviesList = getMoviesByCategory(categoryList[i])
screen.SetContentList(i,tmpMoviesList)
seriesList.AddTail(tmpMoviesList)
end for
dlg.close()
while true
msg = wait(10, port)
if msg <> invalid and type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed() then
exit while
else if msg.isListItemSelected() then
selection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]
if selection.Title = "Search"
searchMovies()
else if selection.Title = "Favorites"
FavoritesMovies()
else
showSpringboardScreenMovies(selection)
end if
end if
end if
end while
End Sub
Function getCategoryListMovies() as object
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/category.php?t=movie")
json = ParseJson(jsonAsString.GetToString())
return json
End Function
Function getMoviesByCategory(category)
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/movie.php?cat="+spaceEscape(category))
json = ParseJson(jsonAsString.GetToString())
return json.Videos
End Function
error
[upload|NQqtReuwJw5f7N7jkW/txA==]
That looks like you’re getting a back index back from the event. You should add a null check…
Instead of
selection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]
Break it into multiple statements…
list = seriesList.GetEntry(msg.GetIndex())
if list <> invalid then
selection = list[msg.GetData()]
end if
“TheEndless” wrote:
That looks like you’re getting a back index back from the event. You should add a null check…
Instead ofselection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]Break it into multiple statements…
list = seriesList.GetEntry(msg.GetIndex()) if list <> invalid then selection = list[msg.GetData()] end if
I thank you very much worked
I still have the same problem it takes to load all the movies as I can make faster progress
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
“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
“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.
I have on the server side a pager but not as part of roku do I have no idea
