Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
hugetv
Level 7

add a search to roGridScreen

as I can add anything to a category search

this code


' ********************************************************************
' ** flix4free
' ** Copyright (c) 2104 Hemen Kapadia
' ********************************************************************
' Displays the Movies selection screen grid
' Level 2 Screen

Sub showMoviesScreen()
dlg = CreateObject("roOneLineDialog")
dlg.setTitle("Loading Movie Collection")
dlg.showBusyAnimation()
dlg.show()
screen = CreateObject("roGridScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.SetGridStyle("flat-portrait")
screen.SetDescriptionVisible(true)
screen.SetBreadcrumbText("", "Search *")

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()

timer=createobject("rotimespan")
timer.mark()
' 20 seconds = 20000
refreshTime = 10000
currentTime = 0

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

currentTime = currentTime + timer.totalmilliseconds()
'print currentTime
timer.mark()
if currentTime > refreshTime then
currentTime = 0
'print "refresh"
AuthUser()
end if

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()]
showSpringboardScreenMovies(selection)
else if msg.isRemoteKeyPressed() then
if msg.GetIndex() = 10
'print "Search"
searchMovies()
end if

end if
end if
end while

End Sub



Function getCategoryListMovies() as object
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/Dev/category.php?t=movie")
json = ParseJson(jsonAsString.GetToString())
return json
End Function

Function getMoviesByCategory(category)
jsonAsString = CreateObject("roUrlTransfer")
jsonAsString.SetURL("http://"+initConfig()+"/Dev/movie.php?cat="+category)
json = ParseJson(jsonAsString.GetToString())
return json.Videos
End Function

Our system http://www.rokumanager.com
0 Kudos
1 Reply
hugetv
Level 7

Re: add a search to roGridScreen

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