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

help with selecting roGridScreen

I want to see how it would be possible to select without having to wait to load all the movies
Our system http://www.rokumanager.com
0 Kudos
12 REPLIES 12
hugetv
Visitor

Re: help with selecting roGridScreen

help pliss
Our system http://www.rokumanager.com
0 Kudos
TheEndless
Channel Surfer

Re: help with selecting roGridScreen

If loading the movies is taking a long time, then your best bet is probably to make the web request asynchronously, so you're not blocking the UI during the request.
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 with selecting roGridScreen

and how it would have this function

   
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL(URL()+"/movie.php?cat="+HttpEncode(category))
json = ParseJson(jsonAsString.GetToString())
return json.Videos
Our system http://www.rokumanager.com
0 Kudos
hugetv
Visitor

Re: help with selecting roGridScreen

please help with this so we can select without having to wait to load the Seciones
Our system http://www.rokumanager.com
0 Kudos
hugetv
Visitor

Re: help with selecting roGridScreen

please help want to select a movie without having to wait to load all content

my code GridScreen

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.ClearMessage()
screen.show()
screen.setListNames(categoryList)

for i = 0 to categoryCount-1
print "id = "; i; " categoria = "; categoryList[i]
contentList = getMoviesByCategory(categoryList[i])
seriesList[i] = contentList
screen.SetContentList(i,contentList)
screen.ClearMessage()
end for

screen.ClearMessage()
screen.show()

dlg.close()

clock = CreateObject("roTimespan")
next_call = clock.TotalMilliseconds() + 36000

while (true)
msg = wait(250, port)

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

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

if (row=0 and col=0) then
searchMovies()
else if (row=0 and col=1) then
FavoritesMovies()
else
'showSpringboardScreenMovies(list,selection)
showSpringboardScreenMovies(list,msg.GetData())
end if

else
print "Unexpected msg type: "; msg.GetType()
print "mensaje: "; msg.getMessage()
end if
end if

if clock.TotalMilliseconds() > next_call then
next_call = clock.TotalMilliseconds() + 36000
end if

end while

End Sub

Function getCategoryListMovies() as object

http = NewHTTP(ServidorRoku()+"/categorias.json")
http.AddParam("t", "peliculas")
response= http.GetToStringWithTimeout(90)
json = ParseJSON(response)
return json

End Function


Function getMoviesByCategory(category)

http = NewHTTP(ServidorRoku()+"/movie.json")
http.AddParam("cat", category)
response= http.GetToStringWithTimeout(90)
json = ParseJSON(response)
return json.Videos

End Function

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

Re: help with selecting roGridScreen

any suggestions to achieve the goal I'm looking to selecionar without having to wait for all content carge
Our system http://www.rokumanager.com
0 Kudos
hugetv
Visitor

Re: help with selecting roGridScreen

who can help me
Our system http://www.rokumanager.com
0 Kudos
TheEndless
Channel Surfer

Re: help with selecting roGridScreen

To make the API requests asynchronously, you'll basically need to use ifUrlTransfer.AsyncGetToString(), then listen for roUrlEvents in your event loop. Once you get the result back, you can then set the contents for the grid screen row(s).

Alternatively, you could opt to work with SceneGraph instead, and utilize the Task node for retrieving your content.
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 with selecting roGridScreen

"TheEndless" wrote:
To make the API requests asynchronously, you'll basically need to use ifUrlTransfer.AsyncGetToString(), then listen for roUrlEvents in your event loop. Once you get the result back, you can then set the contents for the grid screen row(s).

Alternatively, you could opt to work with SceneGraph instead, and utilize the Task node for retrieving your content.


I'm using what I indicas file with urlUtils.brs but since continuous loading
Our system http://www.rokumanager.com
0 Kudos