Converting app with old components (roGridScreen,roPosterScreen, roSpringboardScreen etc) into Scene Graph applications?

Hey all.

I could use a bit of clarification about the requirements to use Roku Scene Graph. All of the components that are going to be deprecated are here: https://blog.roku.com/developer/2017/02/01/legacy-sdk/ … but then in the documentation it shows more functions/components that cannot be used here: https://sdkdocs.roku.com/display/sdkdoc … pt+Support

So my question is, what is the most efficient way to go about this “conversion” of my app that uses the older SDK? For example, I understand that to replace roGridScreen I can use a rowList node class, but how do I implement the XML/BRS files to work together using an API’s JSON data? Since I can’t use methods like SetContentList(), setupLists(), setListNames(), I’m unable to see through the examples how to set content with JSON instead of XML data.

I’ve tried replacing the createObject(“roGridScreen”) with something like this:

  
  m.screen = CreateObject("roSGScreen")
  m.port = CreateObject("roMessagePort")
  m.screen.setMessagePort(m.port)
  scene = m.screen.CreateScene("HomeGrid")
  m.screen.show()

and then I made a test .xml file called “HomeGrid.xml” where I set it up like so, just to see if it’ll link together:

<?xml version="1.0" encoding="utf-8" ?> 
<component name="HomeGrid" extends="Scene" >
' stuff goes here
</component>

but I got an error saying “BRIGHTSCRIPT: ERROR: roSGScreen.CreateScene: No such node HomeGrid.”

Beyond that, I’m just not sure how I change my files/structure so that all of the 40 or so files I have can work with the Roku Scene graph. What goes inside the .xml file?
The documentation and examples are somewhat helpful, but I can’t figure out how to tie it in with what I already have without essentially re-doing my whole application from scratch. I have tons of functions that make requests, responses, general functions. Any help would be appreciated. :disappointed_face:

I’m in the same boat, and I suggest you redo all the UI from scratch. I decided that’s the path of least resistance.
For content, the trick is to extend the ContentNode to include all your custom fields, then apply your array of content nodes to a List. You will probably be able to re-use the bulk of your JSON data parser. I found the requirements a little bit confusing, because the List elements require a structure of ContentNodes that is very specific, and it doesn’t work right until you hit the right construct. You don’t just simply load an array of elements like you did with a PosterScreen.

“tim_beynart” wrote:
I’m in the same boat, and I suggest you redo all the UI from scratch. I decided that’s the path of least resistance.
For content, the trick is to extend the ContentNode to include all your custom fields, then apply your array of content nodes to a List. You will probably be able to re-use the bulk of your JSON data parser. I found the requirements a little bit confusing, because the List elements require a structure of ContentNodes that is very specific, and it doesn’t work right until you hit the right construct. You don’t just simply load an array of elements like you did with a PosterScreen.
Hmm, have you looked at the videoplayer example? From all the examples I’ve seen, this one looks the most like what I already have. https://github.com/rokudev/videoplayer-channel
If you don’t mind, would I be able to see an example of what you’re talking about? It’s still a bit fuzzy to me. Thank you!

This may not be the info you are looking for, I’m not sure I read your question right. For your content feed, it looks like the parseLeaf() function (in UriHandler.brs) in that demo is what you need to modify
https://github.com/rokudev/videoplayer-channel/blob/master/components/UriHandler.brs
instead of contentNode= CreateObject(“roSGNode”,“ContentNode”), you would use a custom component that extends ContentNode, like contentNode= CreateObject(“roSGNode”,“MyExtendedContentNode”)
and define the custom node like this, in an XML file called MyExtendedContentNode.xml

<?xml version="1.0" encoding="utf-8" ?>
<component name="MyExtendedContentNode" extends="ContentNode">
<interface>
  <field id="thumbnail" type="string" />
  <field id="contentType" type="string" />
  <field id="title" type="string" />
  <field id="entitlement" type="string" />
  <field id="externalAdvertiserId" type="string" />
  <field id="mediaGuid" type="string" />
  <field id="accountId" type="string" />
  <field id="duration" type="float" />
  <field id="trackingData" type="assocarray" />
  <field id="category" type="string" />
</interface>
</component>

Then as you parse your JSON you can assign all the custom fields you require and the List component in SG will still honor the fundamental fields of a ContentNode.

“tim_beynart” wrote:
This may not be the info you are looking for, I’m not sure I read your question right. For your content feed, it looks like the parseLeaf() function (in UriHandler.brs) in that demo is what you need to modify
https://github.com/rokudev/videoplayer-channel/blob/master/components/UriHandler.brs
instead of contentNode= CreateObject(“roSGNode”,“ContentNode”), you would use a custom component that extends ContentNode, likecontentNode= CreateObject(“roSGNode”,“MyExtendedContentNode”)[/size][/font][/color]
and define the custom node like this, in an XML file called MyExtendedContentNode.xml



Then as you parse your JSON you can assign all the custom fields you require and the List component in SG will still honor the fundamental fields of a ContentNode.
Hmmm… very confusing. What exactly is the size, font, color you listed? And how do those styles connect to the ContentNode? There are multiple fields (thumbnail, contentType) so these styles would apply to all of the fields?

The size font color junk in the message is automatically entered when you copy and paste sometimes into the message box on the forum - you can ignore all that.

“destruk” wrote:
The size font color junk in the message is automatically entered when you copy and paste sometimes into the message box on the forum - you can ignore all that.
oh thanks, destruk! but then where in that myExtendedContentNode component are all of those styles being applied?

You’d need to add those fields to your extended content node if you want to have specific fonts, sizes, or placement associated with your content. Or you could put those values into a separate array. It’s an open system so you can organize your data any way you like, but the existing components are easier to use if you comply with the supported content metadata and content nodes or extended content nodes.
https://sdkdocs.roku.com/display/sdkdoc/Font

“destruk” wrote:
You’d need to add those fields to your extended content node if you want to have specific fonts, sizes, or placement associated with your content. Or you could put those values into a separate array. It’s an open system so you can organize your data any way you like, but the existing components are easier to use if you comply with the supported content metadata and content nodes or extended content nodes.
https://sdkdocs.roku.com/display/sdkdoc/Font
I don’t use any specific fonts or colors or anything with the older components. I just have my global theme styles from the roAppManager set up in a themes file and thats it. My main concern is really how MUCH do I actually have to change? Just the components that deprecate? It’s all so confusing, and my app is giant with convoluted files and functions. Sigh..

If your current app is convoluted, then now is a good time to rewrite and streamline it. I printed out the code for all of the last channel upgrade I did and went through with a sharpie crossing out code that wasn’t used. It saved a lot of headache. Basically, any UI screens need to be recreated - if you used roScreen/roImageCanvas then that’s a lot of work - if you used the default posterscreen or gridscreen then it’s easier. Also the video component changed so that will need to be recreated, and the springboard screen needs to be recreated, and the linking/billing routines might need to be recreated. Take it screen by screen, take your time, get one part working and test it, and then move on to the next display.

dang sorry about that formatting stuff, posting to this forum is beyond my capabilities.

“destruk” wrote:
If your current app is convoluted, then now is a good time to rewrite and streamline it. I printed out the code for all of the last channel upgrade I did and went through with a sharpie crossing out code that wasn’t used. It saved a lot of headache. Basically, any UI screens need to be recreated - if you used roScreen/roImageCanvas then that’s a lot of work - if you used the default posterscreen or gridscreen then it’s easier. Also the video component changed so that will need to be recreated, and the springboard screen needs to be recreated, and the linking/billing routines might need to be recreated. Take it screen by screen, take your time, get one part working and test it, and then move on to the next display.
Not convoluted in a bad way, but there’s just a lot going on, tons of functions and requests that can’t be erased, but yeah… I definitely have to take it one screen at a time. There is aloooot thats going to be different. All of my screens are split into their own files and have their own createObject instances for the grid, poster, detail screen, video screen etc. And each of these files have functions used in them from OTHER .brs files. How does this get affected by the Scene Graph stuff? Did tons of research, can barely find anything.
I thought I could have multiple instances of roSGScreen, but it seems like one is enough and I have to do fancy things to incorporate the other screens. Several questions:

  1. are there ANY good examples/documentation on how this works with an API/JSON!? I can’t seem to find it anywhere…everything I find is mostly with an XML feed or hard-coded. @tim_beynart 's explanation is about as close to any example I’ve got, and I still don’t understand how it ties in with the response files and the visual screens.

  2. I keep getting an error “BRIGHTSCRIPT: ERROR: No such node”. Even when I erase all extra code and keep 2 simple files, I can’t even get one SG Screen to work. Also can’t find any info about this error on the forums or online :disappointed_face:

This is no easy feat…

For JSON parsing, here’s some code I threw on GitHub. It’s not a complete application, don’t have time right now for that, but hopefully this helps.
https://gist.github.com/timbeynart-nbcu … 8c104f82af

“tim_beynart” wrote:
For JSON parsing, here’s some code I threw on GitHub. It’s not a complete application, don’t have time right now for that, but hopefully this helps.
https://gist.github.com/timbeynart-nbcu … 8c104f82af
Thank you!!!