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: 
parag
Visitor

Display Rating attribute icon for a movie/episode

How do you display the rating attributes icon on the descriptions screen? Previously, if setup the content-data correctly for roSpringboardScreen, the attributes were displayed correctly. But, since that has been deprecated, are you supposed to use a Poster to display the icon? If so, do you get them from 'common:/'?

Thanks.
0 Kudos
4 REPLIES 4
donpec
Visitor

Re: Display Rating attribute icon for a movie/episode

I'm in the same problem mate, any ideas???
0 Kudos
parag
Visitor

Re: Display Rating attribute icon for a movie/episode

I just ended up using my own icons/text instead. Could not find anything else that worked.
0 Kudos
streamotor
Visitor

Re: Display Rating attribute icon for a movie/episode

how did you display the rating in the details screen? any code would be helpful thanks
0 Kudos
parag
Visitor

Re: Display Rating attribute icon for a movie/episode

I created a horizontal LayoutGroup to display release date, rating and hd icon.

<component name="Details" extends="LayoutGroup" xsi:noNamespaceSchemaLocation="https://devtools.web.roku.com/schema/RokuSceneGraph.xsd">[/color]
<interface>[/color]
        <!-- Content node -->
        <field id="Content" type="node" onChange="OnContentChanged"/>[/color]
    </interface>[/color]

<script type="text/brightscript" uri="pkg:/components/screens/Description/Details.brs" />[/color]

<children>[/color]
<Label id="releaseDate" text="" />[/color]
<Label id="rating" text="" />[/color]
<!--Poster id="rating" height="24" width="48" loadDisplayMode="scaleToFit" /-->
<Poster id="isHD" height="30" width="48" loadDisplayMode="scaleToFit"/>[/color]
</children>[/color]

</component>[/color]

Then in the brs file, in OnContentChange(), I update the text/icons appropriately, I used text for rating, but you can use icons if you have them or create them.

Sub OnContentChanged()
    item = m.top.content

    spacings = [15, 15, 15]

    'release date[/color]
    if item.releaseDate <> invalid and item.releaseDate <> ""
        m.top.releaseDate.text = item.releaseDate.split("/")[2] 'year
    else
        m.top.releaseDate.text = ""
        spacings[0] = 0
    end if

    'rating[/color]
'    if item.rating = "G"
'        m.top.rating.uri = "pkg:/images/g.png"
'    else if item.rating = "NC-17"
'        m.top.rating.uri = "pkg:/images/nc17.png"
'    else if item.rating = "PG"
'        m.top.rating.uri = "pkg:/images/pg.png"
'    else if item.rating = "PG-13"
'        m.top.rating.uri = "pkg:/images/pg13.png"
'    else if item.rating = "R"
'        m.top.rating.uri = "pkg:/images/r.png"
'    else if item.rating = "NR"
'        m.top.rating.uri = "pkg:/images/nr.png"
'    else if item.rating = "TV-Y"
'        m.top.rating.uri = "pkg:/images/tvy.png"
'    else if item.rating = "TV-Y7"
'        m.top.rating.uri = "pkg:/images/tvy7.png"
'    else if item.rating = "TV-Y7-FV"
'        m.top.rating.uri = "pkg:/images/tvy7fv.png"
'    else if item.rating = "TV-G"
'        m.top.rating.uri = "pkg:/images/tvg.png"
'    else if item.rating = "TV-PG"
'        m.top.rating.uri = "pkg:/images/tvpg.png"
'    else if item.rating = "TV-14"
'        m.top.rating.uri = "pkg:/images/tv14.png"
'    else if item.rating = "TV-MA"
'        m.top.rating.uri = "pkg:/images/tvma.png"
'    else
'        m.top.rating.uri = "pkg:/images/ur.png"
'    end if
    
    if item.rating = invalid or item.rating = ""
        m.top.rating.text = "NR"
    else
        m.top.rating.text = item.rating
    end if
    
    'resolution[/color]
    m.isHD.uri= "pkg:/images/hd.png"[/color]
    
    m.top.itemSpacings = spacings
End Sub

I managed spacings between items to ensure that things were spaced correctly for ex. if the release date was missing.

Hope it helps!!!
0 Kudos