Series/Episode categorization with the RDP-To-Scenegraph example

After a lot of digging and experimentation, I think I have discovered how to implement category names with episodes and seasons along with generic movie/short form video category names on the RDP-to-Scenegraph master zip, available at this GIT location: https://github.com/rokudev/rdp-to-scenegraph-channel-template

First off, thank you to__* @37mediagroup *__for the nudge in the right direction for updating the Components/Content/RootHandler.brs file. That is necessary in part, but I want to help break it down futher for others looking for episodes and season categories..

Line 100 of the RootHandler needs to have the category names you have defined in your JSON file. These are the names that you will see displayed on the channel and should be names as such. For example, mine has the following:

if item = "series" or item = "Cornhole Series" or item = "Sports Talk"

…then my JSON file will have the above names as the names with content that used to be a single “series” entry. As an example, what used to just be the “series” entry with different named series…

"providerName": ...,
"lastUpdated": ...,
"language": ...,
"series": [
  {
  "id" ....,
  "title" "Cornhole Series"
  ...
  },
  {
  "id" ....,
  "title" "Sports Talk"
  ...
  }
]

can now be seen as:

"providerName": ...,
"lastUpdated": ...,
"language": ...,
"Cornhole Series": [
  {
  "id" ....,
  "title" "Cornhole Series"
  ...
  }
],
  "Sports Talk" : [
  {
  "id" ....,
  "title" "Sports Talk"
  ...
  }
]

I have pulled each of my series out of the categorized “series” entry, and labeled the series as such for my own named listings.

… and then for the “movies” or short form videos, I have done a similar set up as above, and used the category names I want have shown in place of “movies” and then added additional entries after each open brace as such:

"Example 1": [
  { ... movie one in a certain category here ... },
  { ... second in a series of movies in a category here ... } ,
  { ... third movie here ... }
],
"Example 2": [
  { ... different category movie 1 here ... },
  { ... different category movie 2 here ... },
  { ... third movie here ... }
],
"Example 3": [
  { ... last category movie 1 here ... },
  { ... last category movie 2 here ... }
]

The above examples allows you to place single categoriezed series in a row. I have a handful of different shows on my channel, and many of them can be grouped together in like categories (self defence, sport recap talk show, live high school sports… all under “Sports”

Now… If you want a row of all of your different series to display, so you see a series on a travevl show, next to a series on a sporting show, etc, you can use the existing “series” entry in the JSON like we always have. However, to change it to someting a little more user friendly like “Our Series” or “Original Features” etc, you have to alter it in the RootHandler line 138 from this:

rowAA = {
  title: item
  children: children
}

to this:

if item = "series"
  rowAA = {
    title: "Original Series" ' <-- you can enter your own name here
    children: children
  }
else
  rowAA = {
    title: item
    children: children
  }

Now here is where things get fun. Starting on line 24 in the DetailsViewLogic.brs file, you will see the following code:

sub OnDetailsContentSet(event as Object)
  btnsContent = CreateObject("roSGNode", "ContentNode")
  if event.GetData().TITLE = "series"
    btnsContent.Update({ children: [{ title: "Episodes", id: "episodes" }] })
  else
    btnsContent.Update({ children: [{ title: "Play", id: "play" }] })
  end if

This is the code you will update to include your original named series files in your JSON. So using my example above, I would add into this section a few lines of code so tha tmine would show like this:

sub OnDetailsContentSet(event as Object)
  btnsContent = CreateObject("roSGNode", "ContentNode")
  if event.GetData().TITLE = "series"
    btnsContent.Update({ children: [{ title: "Episodes", id: "episodes" }] })
  elseif event.GetData().TITLE = "Original Series"
    btnsContent.Update({ children: [{ title: "Episodes", id: "episodes" }] })
  elseif event.GetData().TITLE = "Sports Talk"
    btnsContent.Update({ children: [{ title: "Episodes", id: "episodes" }] })
  elseif event.GetData().TITLE = "Cornhole Series"
    btnsContent.Update({ children: [{ title: "Episodes", id: "episodes" }] })
  else
    btnsContent.Update({ children: [{ title: "Play", id: "play" }] })
  end if

I’ve included the “Original Series” title here as well as that is what I renamed my “series” row to on line 138 in the RootHandler.brs file

With the above I have done the following:

  • Renamed “series” to “Original Series” as the row title on my channel, and allowed for all of those series to correctly function wiht the seasons/episodes.
  • Added original categories of series under the names “Sports Talk” and “Cornhole Series” so that i will see only those categoried programs on that row, and they too have the season/episode funtionality
  • Added original categories for single movie and single episode content based on my JSON feed.

Thank you for taken the time to share your codes and structure, Nice job1 i my self like what you done and want to mtry and see if I can make something like this with one of my channels that uses a tvspecials category but pull episodes from playlist. I can only get one line of videos like most here and trying to figure how to pull the playlist categories. I want to try your method and see if this can work without having to change the whole json feed!

It would of been nice to actually see your json feed file. I followed your process but failed as I got errors from the root handler file and I believe its because I am not understanding the feed file code process you done here. I think if we seen an actual sample we may have that ah ha moment.

I can appreciate that… And perhaps if you have other errors in your .brs files, you may want to review the full package. Here is a complete “sample channel” that is working with the feed file in the zip for you to review, edit, and upload where you see fit. If you simply upload the SampleChannel zip as it is, you will see the working channel shown below.

https://phlumestream.000webhostapp.com/RDP-to-SG-Example.zip

Also, should you just want to jump to the JSON that is linked within the above channel, that feed file is here for review:

https://phlumestream.000webhostapp.com/test-feed.json

Thank you for your kindness and help. I can see where I went wrong in my feed now, Its amazing how a character or two can throw you off LOL!

I appreciate your sample files too, Huge help!

Thanks for the shoutout. I’m not the best at a lot of this stuff, but I can come off the bench & knock down a couple 3’s now & then to help out :grin: :+1:

Download the zip and inside is a copy of the feed file along with the sample app!

https://phlumestream.000webhostapp.com/RDP-to-SG-Example.zip

Thank you Phlume for providing such detailed information.

I have a DP channel I am converting and my json has categories and at the bottom of the json are playlists that use the content ID’s of the content I wanted to display on each row.

If I understand correctly, for each row of content aka “category” I want displayed, I have to go to the RootHandlerBRS line 100 and type a “if item =” for each row/category name that I want to see listed? Is this correct?

I wish there was a way for it to pull info from the playlists in the json so I don’t have to rewrite the json feed.

Regardless, I do appreciate what you have added to the forum. Going to see what I can do to get my channel converted over.

Thank you.

@newchannel yes, in part. There is still more to do after adjusting line 100, but this is needed as well.

If you have a category names “Snakes” then you will need:

Line 100 (RootHandler):

if item = "snakes" ...

In your JSON:

...
"Snakes": [
  {
  "id" ....,
  "title" "Snakes"
  ...
  }
],
...

In DetailsViewlogic.brs you need to adjust line 24 to include ‘snakes’:

...
sub OnDetailsContentSet(event as Object)
  btnsContent = CreateObject("roSGNode", "ContentNode")
  if event.GetData().TITLE = "series"
    btnsContent.Update({ children: [{ title: "Episodes", id: "episodes" }] })
  elseif event.GetData().TITLE = "Snakes"
    btnsContent.Update({ children: [{ title: "Episodes", id: "episodes" }] })
...

Thank you again.

I was able to take my live stream and make it a category since there is the option of “liveFeeds” listed already in the RootHandler.

Next I will attempt to add my additional categories.

Plus, I need to change the order. The channel opens with series, shortform, movies and live and I need to look further to see how to move these around so that the live is first.

Got the Live TV category working. But, how do you move the categories around? Let’s say for example I want Live TV to be the first row and Movies to be the second row. What controls the order of the rows?

Thank you.

The 500 kb feed limit… I’m now wondering if this will be a problem. If yes, then I read Roku SDK needs to be used and not the rdp to scenegraph example. Guess I’ll look for an sdk example to review.

Also, “series” shows up first and not sure how to move it further down. I can make new categories but can’t put them in the right order I want.

Can anyone provide info on these 2 thoughts?

Try changing the dates on the items instead of trying to move them in the feed!

I’ve tried updating the position in the feed, changing the dates (releaseDate and dateAdded), and even updating the content ID so it would sort numerically, but nothing seems to work for me for the sort position.

As for the 500kb limit… I have 380 videos on my channel and the JSON feed is 410kb… I’m.not sure what happens with more than 500, but that is a TON of content.

Hey I dont know whats in your feed but if you have category tags at the bottom of your feed they would control whats being parsed! Example by item id number and postion of category listed!

If you send ur feed link i could look at it!

That is a lot of content fitting within the 500 kb parameter. I think I’ll be okay on this then.

As for the json, it has category tags at the bottom and above that I have playlists. This is the original feed I used for DP before making too many changes to change over to the scenegraph example.

I was able to setup a placeholder category titled “New” and added one video to test by making an addition in the RootHandler.brs and the “New” category displays on the tv. I didn’t have to make a change in the DetailsViewLogic.brs for it to work. I guess it didn’t require the change in the DetailsViewLogic.brs because it was a single video and not a series?

The top category displaying is “Series”. I want to move this category down.

In the current json at Line 1291 is where I have added the “New” placeholder test category. After that is the “Live TV” and after that is the “Movies” category.  “Series” in the json is at Line 2507. At the bottom of the json there are playlists, for example here is the code for one of the playlists from original json:

{
“name”: “livetv”,
“itemIds”: [
“VTNlive”,
“nrblive”
]
},

Below the playlists at the very bottom of my json are the category tags. For example:

“categories”: [{
“name”: “Featured”,
“playlistName”: “short-form”,
“order”: “manual”
},
{
“name”: “Live TV”,
“playlistName”: “livetv”,
“order”: “manual”
},
{
“name”: “New”,
“playlistName”: “new”,
“order”: “manual”
},

The point I’m trying to make I guess is to say that the order of the categories at the bottom of my json are not the same order on the tv.  “Series” shows first then the “shortFormVideos” (I’ll be updating the name of this category in the json), then “New” then “Movies” then “Live TV”. If the json feed has in this order

“New”

“Live TV”

“Movies”

Why doesn’t this same order show on the tv which displays as:

“New”

“Movies”

“Live TV”

I have not tried doing anything with changing dates as yet. I’ll be testing more on this. I’ve just recently begun working to test things. I can add new categories, just can’t get them in the right order.

Thank you both for your input. Much appreciated.

If you are correctly using category tags and playlist then you should be using Playlist names with

item id’s

“itemIds”:[“97784-22388-4286878”,“vt7LCaucEqe”,“97786-22390-4286880”,“JCHU0YEDdAK”,“97788-22392-4286882”,“97790-22394-4286884”,“97784-22388-4286878”,“97792-22396-4286888”,“97790-22394-4286884”,“97788-22392-4286882”

The postion of an item ID can change how its displayed!

The json worked perfectly for DP. I was able to move videos in a category in what ever order I wanted using the ID’s. And, I was able in DP with this same json to move each category up or down.

But, now “Series” is always first and when I add a new category it gets moved to a different placeholder than where I want it to go. Something somewhere in the code is putting series first because my json doesn’t not have “Series” set for the top row.

I understand and know, I even posted about it here and nobody has a solution But the category tags with playlist and item ids kinda work!

I’m looking back over my feed again. I have the ID’s of the videos typed in the playlist that they are to go into and each category is assigned a playlistname. It seems the playlists are being ignored or overridden by what I have typed at the top of the feed where I have the list of all of the videos within a section ie:

“shortFormVideos”: [{

here would be all of those videos then

another section called “New” etc

then down further playlistnames with video ID’s

then cateogories with the playlistnames

All videos in that shortformvideos section display on the tv even if I don’t have all of those video ID’s assigned to a playlistname. It’s displaying all of the videos in the “shortformvideos” section

Going back over the json feed again and move some things around and make a few changes to see what happens. Plus, the tags beneath each video I’ll check those as well and see what happens. Before I didnt have those tags set as being assigned to a playlist or category.

Sure is strange how this json worked perfectly in DP and not the example, so must be something in the main code of the example that won’t just accept the url of the json with the category feed and addition to the roothandler and display everything the same as it did in DP…ugh :slightly_smiling_face:

Thanks a ton.