Forum Discussion

hugetv's avatar
hugetv
Visitor
10 years ago

help to roGridScreen fast loading content

I can help to load the covers as fast as 1,000 movies surpasses the content is put slow loading



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)
screen.show()
end for

screen.show()

dlg.close()
while true
msg = wait(0, port)

if msg <> invalid and type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed() then
exit while
else if msg.isListItemFocused()
print "Focused msg: ";msg.GetMessage();"row: ";msg.GetIndex();
print " col: ";msg.GetData()
else if msg.isListItemSelected() then
print "Selected msg: ";msg.GetMessage();"row: ";msg.GetIndex();
'selection = seriesList.GetEntry(msg.GetIndex())[msg.GetData()]

list = seriesList.GetEntry(msg.GetIndex())
if list <> invalid then
selection = list[msg.GetData()]
end if

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(UrlServidor()+"/category.php?t=movies")
json = ParseJson(jsonAsString.GetToString())
return json
End Function


Function getMoviesByCategory(category)
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL(UrlServidor()+"/movies.php?cat="+category)
json = ParseJson(jsonAsString.GetToString())
return json.Videos

End Function

  • please help to how to avoid not charge slow if not open much faster
  • You'll likely need to address it on the server end. If you need to load that many objects without slowing down the UI, then you'll need to implement some sort of paging.
  • which would be the solution you indicate I appreciate your help
  • someone could help me please because the server goes down with so many requests to make a solution and resolve carrying non once the content