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

VideoPlayer XML Question

Hi I was wondering if someone could point me in the right direction I need to add Ratings, Release Date, and Director to my XML files to display on the RoSpringboard
using the videoplayer example I have looked at the SDK ver4.1 and looking in the Component Reference pdf I see in the Rospringboard layout it shows them there but when I look at the XML file the fields are not there. I also notice that in the XML file that some of the categories do not match up to what they are example below

<item sdImg="location of image" hdImg="location of image">
<title>Movie title</title>
<contentId>10011</contentId>
<contentType>Classic Film</contentType>
<contentQuality>SD</contentQuality>
<media>
<streamFormat>mp4</streamFormat>
<streamQuality>SD</streamQuality>
<streamBitrate>1500</streamBitrate>
<streamUrl>location of video</streamUrl>
</media>
<synopsis>description of film</synopsis>
<genres>Classic Film</genres> THIS FIELD IS ACTUALLY ACTORS ON THE roSpringboard
<runtime>7200</runtime>
<releasedate></releasedate> Need to add this
<rating></rating> Need to add this
<Director></Director> Need to add this

</item>

I hope this makes sence and thanks in advance for any help
Cheers
DEW
0 Kudos
11 REPLIES 11
joetesta
Roku Guru

Re: VideoPlayer XML Question

Hi dew,

in showFeed.brs there is 'Function parse_show_feed' at line 115 and in there you should see a whole block of "item.SOMETHING = validstr(curShow.SOMETHING)" starting at line 130

This is the area you are concerned with. In our version of this file, we added:
        item.Director         = validstr(curShow.director.GetText())
item.ReleaseDate = validstr(curShow.releasedate.GetText())


and in the XML files we have (for example)
                <director>Bob</director>
<releasedate>Released: 2008</releasedate>


I'm not sure how these will get output; since it's been a while, I tried looking in the DesignGuidelines.pdf Section 4.4 Details Screen but it's pretty vague as to how the Metadata fields work so I guess you'll have to experiment a bit.
aspiring
0 Kudos
dew
Visitor

Re: VideoPlayer XML Question

Hi joetesta thanks for your help. I have a couple of questions I seemed to cant get my head around. First of all I am not a programmer I just build web pages so here goes
This is all I need to do before I can publish my channel
1. Using the Videoplayer example I need to add the following fields both in the sorce code and in the XML
a. Director
b. rating ( I believe this is a image do I need to supply it or is it in the Roku box?)
c. Categories 1
d. Categories 2
e. release date
f. change the color of text on the Play and Resume Play un-focused buttton at the moment it is grey when not selected I need it to be white(#ffffff)
g. and somehow get the 4 line of text (250 ch) for the synopsis ( description) at the monent I only get 2 lines and ... at the end.

here is my xml file with everything in it but the ratings not sure how to add that.

Code: Select all
<item sdImg="location of image" hdImg="location of image">
<title>Movie title</title>
<contentId>10011</contentId>
<contentType>Classic Film</contentType>
<contentQuality>SD</contentQuality>
<media>
<streamFormat>mp4</streamFormat>
<streamQuality>SD</streamQuality>
<streamBitrate>1500</streamBitrate>
<streamUrl>location of video</streamUrl>
</media>
<synopsis>description of film</synopsis>
<genres>Classic Film</genres> THIS FIELD IS ACTUALLY ACTORS ON THE roSpringboard
<runtime>7200</runtime>
<releasedate></releasedate> Need to add this
<rating></rating> Need to add this but I believe it is a image?
<Director></Director> Need to add this
<category1></category1>Need to add this
<category2></category2>Need to add this
</item>

here is my appMain.brs info


Code: Select all
theme.BreadcrumbTextLeft = "#003366"
theme.BreadcrumbTextRight = "#003366"
theme.SpringboardActorColor = "#FFFFFF"
theme.BackgroundColor = "#006699"
theme.SpringboardRuntimeColor = "#003366"
theme.SpringboardSynopsisColor = "#ffffff"
theme.SpringboardGenreColor = "#000000"
theme.SpringboardTitleText = "#003366"

theme.SpringboardReleaseDateColor = "#ffffff"
theme.SpringboardDirectorText = "Written by"
theme.SpringboardDirectorLabelColor = "#0000FF"
theme.SpringboardDirectorColor = "#ffffff"

theme.PosterScreenLine1Text = "#ffffff"
theme.PosterScreenLine2Text = "#ffffff"

and here is my showfeed.brs

Code: Select all
Function init_show_feed_item() As Object
o = CreateObject("roAssociativeArray")

o.ContentId = ""
o.Title = ""
o.ContentType = ""
o.ContentQuality = ""
o.Synopsis = ""
o.Genre = ""
o.ReleaseDate = ""
o.Director = ""
o.Runtime = ""
o.category1 = ""
o.category2 = ""

o.StreamQualities = CreateObject("roArray", 5, true)
o.StreamBitrates = CreateObject("roArray", 5, true)
o.StreamUrls = CreateObject("roArray", 5, true)

return o
End Function

and I believe they go here to

Code: Select all
Function parse_show_feed(xml As Object, feed As Object) As Void

showCount = 0
showList = xml.GetChildElements()

for each curShow in showList

'for now, don't process meta info about the feed size
if curShow.GetName() = "resultLength" or curShow.GetName() = "endIndex" then
goto skipitem
endif

item = init_show_feed_item()

'fetch all values from the xml for the current show
item.hdImg = validstr(curShow@hdImg)
item.sdImg = validstr(curShow@sdImg)
item.ContentId = validstr(curShow.contentId.GetText())
item.Title = validstr(curShow.title.GetText())
item.Description = validstr(curShow.description.GetText())
item.ContentType = validstr(curShow.contentType.GetText())
item.ContentQuality = validstr(curShow.contentQuality.GetText())
item.Synopsis = validstr(curShow.synopsis.GetText())
item.Genre = validstr(curShow.genres.GetText())
item.Director = validstr(curShow.director.GetText())
item.ReleaseDate = validstr(curShow.releasedate.GetText())
item.Runtime = validstr(curShow.runtime.GetText())
item.HDBifUrl = validstr(curShow.hdBifUrl.GetText())
item.SDBifUrl = validstr(curShow.sdBifUrl.GetText())
item.StreamFormat = validstr(curShow.streamFormat.GetText())
if item.StreamFormat = "" then 'set default streamFormat to mp4 if doesn't exist in xml
item.StreamFormat = "mp4"
endif

Basicly I need to match my xml file so that it can display the info in it on the roSpringboard page so I can display them.
It would be nice if the videoplayer example had all of the data in it so you could turn on or turn off what you did not need or so you could see how it was added

Thanks in advance for your help I'm just stuck at the moment
Cheers
DEWdew

Posts: 16
Joined: Mon Dec 05, 2011 12:53 pm
0 Kudos
bandal
Visitor

Re: VideoPlayer XML Question

Dew,

On the Star Rating you might have somewhere in the detailScreen.brs
screen.SetStaticRatingEnabled(false) if so, remove it and it will show up or put true versus false.

On the Release Date see the showFeed.brs and check that you have
o.ReleaseDate = ""
item.ReleaseDate = validstr(curShow.releasedate.GetText())
Then in the xml you can enter the text as Release Date: 01/01/2012 or another format like 2009 or 1/2/2010 or June 10, 2012
0 Kudos
dew
Visitor

Re: VideoPlayer XML Question

Hi Bandal, thanks for that yeah I have turned off the star ratings but I am still having problems getting the Director to display and the release date
ok here is my code for my showFeed.brs starting at line 52
Function init_show_feed_item() As Object
o = CreateObject("roAssociativeArray")

o.ContentId = ""
o.Title = ""
o.ContentType = ""
o.ContentQuality = ""
o.Synopsis = ""
o.Genre = ""
o.ReleaseDate = ""
o.Director = ""
o.Runtime = ""
o.StreamQualities = CreateObject("roArray", 5, true)
o.StreamBitrates = CreateObject("roArray", 5, true)
o.StreamUrls = CreateObject("roArray", 5, true)

return o
End Function


And here is my code starting at line 131
  'fetch all values from the xml for the current show
item.hdImg = validstr(curShow@hdImg)
item.sdImg = validstr(curShow@sdImg)
item.ContentId = validstr(curShow.contentId.GetText())
item.Title = validstr(curShow.title.GetText())
item.Description = validstr(curShow.description.GetText())
item.ContentType = validstr(curShow.contentType.GetText())
item.ContentQuality = validstr(curShow.contentQuality.GetText())
item.Synopsis = validstr(curShow.synopsis.GetText())
item.Genre = validstr(curShow.genres.GetText())
item.Director = validstr(curShow.director.GetText())
item.ReleaseDate = validstr(curShow.releasedate.GetText())
item.Runtime = validstr(curShow.runtime.GetText())
item.HDBifUrl = validstr(curShow.hdBifUrl.GetText())
item.SDBifUrl = validstr(curShow.sdBifUrl.GetText())
item.StreamFormat = validstr(curShow.streamFormat.GetText())
if item.StreamFormat = "" then 'set default streamFormat to mp4 if doesn't exist in xml
item.StreamFormat = "mp4"
endif


Also I was looking at the code futher down starting at lne 158 and should I be putting someting in here?
item.Length = strtoi(item.Runtime)
item.Categories = CreateObject("roArray", 5, true)
item.Categories.Push(item.Genre)
item.Actors = CreateObject("roArray", 5, true)
item.Actors.Push(item.Genre)
item.Description = item.Synopsis


here is test xml I am using
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed>
<!-- resultLength indicates the total number of results for this feed -->
<resultLength>4</resultLength>
<!-- endIndex indicates the number of results for this *paged* section of the feed -->
<endIndex>4</endIndex>
<item sdImg="test-image.jpg" hdImg="test-image.jpg">
<title>Movie title</title>
<contentId>100133</contentId>
<contentType>movie</contentType>
<contentQuality>SD</contentQuality>
<media>
<streamFormat>mp4</streamFormat>
<streamQuality>SD</streamQuality>
<streamBitrate>1200</streamBitrate>
<streamUrl>film-location.mp4</streamUrl>
</media>
<synopsis>Discription of film"</synopsis>
<genres>Actor1 Actor2</genres>
<director>Director</director>
<releasedate>2012</releasedate>
<runtime>7200</runtime>
</item>
</feed>


Can you see anyting wrong in what I have done? I just can not get it to display, I am sure I am over looking somthing but any help would be much appreciated.

Cheers
DEW
0 Kudos
bandal
Visitor

Re: VideoPlayer XML Question

I compared and I do not see anything wrong. Maybe try to keep formatting all straight down the line in line 131 and have all the items in a column like fashion. Maybe a hidden character in the editor got put in or a tab. Delete and re-add both the lines by hand. I see both lines not in a straight column. I would also do the same in showFeed.brs after line 52 to keep all formatting of text in alignment.
0 Kudos
dew
Visitor

Re: VideoPlayer XML Question

Thanks for that but I have corrcted the alignment now and still they dont display I just dont understand it should work there has to be something I am missing.
Should there be something that relates to the new fields I am adding in the code around line 158?
Cheers
DEW
0 Kudos
belltown
Roku Guru

Re: VideoPlayer XML Question

Try changing Line 10 of appDetailScreen.brs to:

screen.SetDescriptionStyle("movie") 
0 Kudos
dew
Visitor

Re: VideoPlayer XML Question

Thank you belltown, that was it it works 😄 I knew there had to be something simple thanks again for your help
But I have another problem maybe you can guide me through.
On the origional videoplayer example in the xml the field <genres> maps to what refers to in the Component Ref
page 51 it shows [ACTOR1] [ACTOR2][ACTOR3] on the layout but when you put in the actors name in genres in the xml they appear there. But now I have turn on all of the features associated with "movie" I now get the 4 lines of text and the rest of what I have added in the xml file such as Ratings, Releasedate, Director. but now I also get what I put in to genres in the xml in the area called [CATEGORY1][CATEGORY2] as well.
What I am looking to do is have my xml file look somthing like this . genres is in there like that now but I will remove it and use category1 2 3 if I can.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed>
<!-- resultLength indicates the total number of results for this feed -->
<resultLength>4</resultLength>
<!-- endIndex indicates the number of results for this *paged* section of the feed -->
<endIndex>4</endIndex>
<item sdImg="test-image.jpg" hdImg="test-image.jpg">
<title>SABOTAGE</title>
<contentId>100133</contentId>
<contentType>movie</contentType>
<contentQuality>SD</contentQuality>
<media>
<streamFormat>mp4</streamFormat>
<streamQuality>SD</streamQuality>
<streamBitrate>1200</streamBitrate>
<streamUrl>film-location.mp4</streamUrl>
</media>
<synopsis>Description of movie</synopsis>
<genres>Sylvia Sidney Oskar Homolka Desmond Tester</genres>
<director>Alfred Hitchcock</director>
<releasedate>1936</releasedate>
<category1>Drama</category1>
<category2>Romance</category2>
<category3>Mystery</category3>
<actor1>Sylvia Sidney</actor1>
<actor2>Oskar Homolka</actor2>
<actor2>Desmond Tester</actor2>
<rating>PG</rating>
<runtime>7200</runtime>
</item>



</feed>


Then my code on showfeed.brs starting at line 52 would be
Function init_show_feed_item() As Object
o = CreateObject("roAssociativeArray")

o.ContentId = ""
o.Title = ""
o.ContentType = ""
o.ContentQuality = ""
o.Synopsis = ""
o.Genre = ""
o.ReleaseDate = ""
o.Director = ""
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.Rating = ""
o.Runtime = ""
o.StreamQualities = CreateObject("roArray", 5, true)
o.StreamBitrates = CreateObject("roArray", 5, true)
o.StreamUrls = CreateObject("roArray", 5, true)

return o
End Function


then my code starting at line 140 would be

 'fetch all values from the xml for the current show
item.hdImg = validstr(curShow@hdImg)
item.sdImg = validstr(curShow@sdImg)
item.ContentId = validstr(curShow.contentId.GetText())
item.Title = validstr(curShow.title.GetText())
item.Description = validstr(curShow.description.GetText())
item.ContentType = validstr(curShow.contentType.GetText())
item.ContentQuality = validstr(curShow.contentQuality.GetText())
item.Synopsis = validstr(curShow.synopsis.GetText())
item.Genre = validstr(curShow.genres.GetText())
item.Actor1 = validstr(curShow.actor1.GetText())
item.Actor2 = validstr(curShow.actor2.GetText())
item.Actor3 = validstr(curShow.actor3.GetText())
item.Director = validstr(curShow.director.GetText())
item.Category1 = validstr(curShow.category1.GetText())
item.Category2 = validstr(curShow.category2.GetText())
item.Category3 = validstr(curShow.category3.GetText())
item.ReleaseDate = validstr(curShow.releasedate.GetText())
item.Rating = validstr(curShow.rating.GetText())
item.Runtime = validstr(curShow.runtime.GetText())
item.HDBifUrl = validstr(curShow.hdBifUrl.GetText())
item.SDBifUrl = validstr(curShow.sdBifUrl.GetText())
item.StreamFormat = validstr(curShow.streamFormat.GetText())
if item.StreamFormat = "" then 'set default streamFormat to mp4 if doesn't exist in xml
item.StreamFormat = "mp4"
endif



But this code is the one I beleve is mapping the actors to genre but I am not sure how to correct it code starts on line 174

  item.Length = strtoi(item.Runtime)
item.Categories = CreateObject("roArray", 5, true)
item.Categories.Push(item.Genre)
item.Actors = CreateObject("roArray", 5, true)
item.Actors.Push(item.Genre)
item.Description = item.Synopsis


If I remove this line
item.Actors.Push(item.Genre)
it removes genre from the Actors location but my setting above does not work as Actors in xml still does not display. and neither does my categories just genre. I hope this makes sence :?
thanks again for any help
0 Kudos
dew
Visitor

Re: VideoPlayer XML Question

If I remove both lines here
item.Actors = CreateObject("roArray", 5, true)
item.Actors.Push(item.Genre)

I now get [Actor1] [Actor2] [Actor3] displayed where it is suppost to but I have having problems getting it to read from the xml
Can anyone see a problem with my code?
Cheers for any help
DEW
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.