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: 
dcrandall
Level 7

Where did my stars go?

I have an interesting situation that popped-up. This has happened to me before in other ways with other functions, but it's been hard to isolate a test-case.

Basically if I cook the value that we use (0-5, floating point) into the string value of stars "0-100", even though the string is right, even if I box it in an roString or use the String primative... a zero still shows-up.

I can work-around this, but... any ideas?


Function Main()
port = CreateObject("roMessagePort")
springBoard = CreateObject("roSpringboardScreen")
springBoard.SetBreadcrumbText("[location 1]", "[location2]")
springBoard.SetMessagePort(port)
o = CreateObject("roAssociativeArray")
o.ContentType = "episode"
o.Title = "[Title]"
o.ShortDescriptionLine1 = "[ShortDescriptionLine1]"
o.ShortDescriptionLine2 = "[ShortDescriptionLine2]"
o.Description = ""
For i = 1 To 15
o.Description = o.Description + "[Description] "
End For
o.SDPosterUrl = ""
o.HDPosterUrl = ""
o.Rating = "NR"
myRating = "4.0"
converted = val(myRating) * 20
finalRating = stri(converted)
o.StarRating = finalRating
o.ReleaseDate = "[mm/dd/yyyy]"
o.Length = 5400
o.Categories = CreateObject("roArray", 10, true)
o.Categories.Push("[Category1]")
o.Categories.Push("[Category2]")
o.Categories.Push("[Category3]")
o.Actors = CreateObject("roArray", 10, true)
o.Actors.Push("[Actor1]")
o.Actors.Push("[Actor2]")
o.Actors.Push("[Actor3]")
o.Director = "[Director]"
springBoard.SetContent(o)
springBoard.Show()
While True
msg = wait(0, port)
If msg.isScreenClosed() Then
Return -1
Else if msg.isButtonPressed()
print "msg: "; msg.GetMessage(); "idx: "; msg.GetIndex()
End if
End While
End Function


Doesn't show my stars.

This does, however.

Function Main()
port = CreateObject("roMessagePort")
springBoard = CreateObject("roSpringboardScreen")
springBoard.SetBreadcrumbText("[location 1]", "[location2]")
springBoard.SetMessagePort(port)
o = CreateObject("roAssociativeArray")
o.ContentType = "episode"
o.Title = "[Title]"
o.ShortDescriptionLine1 = "[ShortDescriptionLine1]"
o.ShortDescriptionLine2 = "[ShortDescriptionLine2]"
o.Description = ""
For i = 1 To 15
o.Description = o.Description + "[Description] "
End For
o.SDPosterUrl = ""
o.HDPosterUrl = ""
o.Rating = "NR"
o.StarRating = "80"
o.ReleaseDate = "[mm/dd/yyyy]"
o.Length = 5400
o.Categories = CreateObject("roArray", 10, true)
o.Categories.Push("[Category1]")
o.Categories.Push("[Category2]")
o.Categories.Push("[Category3]")
o.Actors = CreateObject("roArray", 10, true)
o.Actors.Push("[Actor1]")
o.Actors.Push("[Actor2]")
o.Actors.Push("[Actor3]")
o.Director = "[Director]"
springBoard.SetContent(o)
springBoard.Show()
While True
msg = wait(0, port)
If msg.isScreenClosed() Then
Return -1
Else if msg.isButtonPressed()
print "msg: "; msg.GetMessage(); "idx: "; msg.GetIndex()
End if
End While
End Function


What gives?
0 Kudos
2 Replies
EnTerr
Level 8

Re: Where did my stars go?

You are putting String inside starRating but it expects Integer, per Content Meta-Data. In your example, skip the stri() line and use `converted`.

The fact that it does not show error nor warning is a widespread issue with ro-components. In your case roSpringboardScreen checks if the value is a number and since it is not, says to itself "fine, i'll go with 0".
0 Kudos
dcrandall
Level 7

Re: Where did my stars go?

Thank you!


The documentation uses "80" in their example, I figured a string had to be it.
0 Kudos