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

I need help to load content separately

Greetings is that I am trying to be able to make faster the entry of the section of the films I want to load the individual categories

ParseUrl.brs
Function GetDataCategory()

    http = NewHttp(m.top.uri)
    source = http.GetToStringWithRetry()
responseJSON = ParseJSON(source)

RowItems=createObject("RoSGNode","ContentNode")
For x=0 To numofcategories
row=createObject("RoSGNode","ContentNode")
row.Id=responseJSON[x].Id
row.Title=responseJSON[x].Title
RowItems.AppendChild(row) 'Add each individual category of items
Next
m.top.content=RowItems 'set top content field to the entire screen's content which will cause the content observer to notice
End Function

Function GetDataMovies()

readInternet=createObject("roUrlTransfer")
readInternet.setUrl(m.top.uri)
source=readInternet.GetToString()
responseJSON = ParseJSON(source)
RowItems=createObject("RoSGNode","ContentNode")
numofitems=responseJSON.Count()-1
For c=0 To numofitems
item=createObject("RoSGNode","ContentNode")
item.Title=responseJSON[c].Title
item.ContentType=responseJSON[c].ContentType
item.ContentId=responseJSON[c].MoviesId
item.Id=responseJSON[c].MoviesId
item.description=responseJSON[c].description
item.url=responseJSON[c].StreamUrls
item.Rating=responseJSON[c].Rating
item.SubtitleUrl=responseJSON[c].SubtitleUrl
item.Length=responseJSON[c].Length
item.streamFormat=responseJSON[c].StreamFormat
item.releasedate=responseJSON[c].ReleaseDate
item.HDPosterURL=m.app.poster + responseJSON[c].HDPosterURL
item.hdbackgroundimageurl=responseJSON[c].hdbackgroundimageurl
RowItems.AppendChild(item) 'Add each individual category of items
Next
m.top.content=RowItems 'set top content field to the entire screen's content which will cause the content observer to notice
End Function


GridScreen.brs
' ********** Copyright 2016 Roku Corp.  All Rights Reserved. **********
'inits grid screen
'creates all children
'sets all observers

Function Init()
Print"[GridScreen] Init"

m.rowList=m.top.findNode("RowList")
m.description=m.top.findNode("Description")
m.background=m.top.findNode("Background")

m.top.observeField("visible","onVisibleChange")
m.top.observeField("focusedChild","OnFocusedChildChange")

m.ParseGrid=m.top.findnode("ParseUrl")
End Function

'handler of focused item in RowList
Sub OnItemFocused()
itemFocused=m.top.itemFocused

m.ParseGrid.uri="movies_items.php?cve="+m.top.content.getChild(itemFocused[0]).Id
m.ParseGrid.FunctionName="GetDataMovies"
m.parsegrid.observefield("content","Moviescontent")
m.ParseGrid.control="RUN"
    itemAA=m.parsegrid.content

If itemFocused.Count()=2
focusedContent=m.parsegrid.content
If focusedContent<>invalid
   print m.top.content.getChild(itemFocused[0]).getChild(itemFocused[1])
m.top.focusedContent=m.top.content.getChild(itemFocused[0]).getChild(itemFocused[1])
m.description.content=focusedContent
m.background.uri=focusedContent.hdBackgroundImageUrl
End If
End If
End Sub

'set proper focus to RowList in case if return from Details Screen
Sub onVisibleChange()
If m.top.visible=TRUE
m.rowList.setFocus(TRUE)
End If
End Sub

'set proper focus to RowList in case if return from Details Screen
Sub OnFocusedChildChange()
If m.top.isInFocusChain() And Not m.rowList.hasFocus()
m.rowList.setFocus(TRUE)
End If
End Sub



This contains all the movies
itemAA=m.parsegrid.content
Our system http://www.rokumanager.com
0 Kudos
5 REPLIES 5
hugetv
Visitor

Re: I need help to load content separately

Someone will have some idea or some help
Our system http://www.rokumanager.com
0 Kudos
xoceunder
Roku Guru

Re: I need help to load content separately

I would like that solution I have the same problem
0 Kudos
hugetv
Visitor

Re: I need help to load content separately

Could someone help me with this please
Our system http://www.rokumanager.com
0 Kudos
abelvaldez
Visitor

Re: I need help to load content separately

I have the same proble. please help
0 Kudos
xoceunder
Roku Guru

Re: I need help to load content separately

they were able to find the solution

0 Kudos