# VideoPlayer XML Question

**URL:** <https://forum.developer.roku.com/t/videoplayer-xml-question/1574>\
**Category:** Archived\
**Tags:** roku-developer-program\
**Created:** [January 29, 2012, 11:13am UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574 "2012-01-29T11:13:43Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dew](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dew](https://forum.developer.roku.com/u/dew)\
**Post date:** [January 29, 2012, 11:13am UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/1 "2012-01-29T11:13:43Z")

</div>

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

\*Movie title\* 10011 Classic Film SD mp4 SD 1500 location of video description of film Classic Film THIS FIELD IS ACTUALLY ACTORS ON THE roSpringboard 7200 Need to add this Need to add this Need to add this

I hope this makes sence and thanks in advance for any help  
Cheers  
DEW

---

<div class="post-metadata">

**Author:** ![joetesta](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@joetesta](https://forum.developer.roku.com/u/joetesta)\
**Post date:** [January 30, 2012, 11:01pm UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/2 "2012-01-30T23:01:52Z")

</div>

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:

```auto
        item.Director = validstr(curShow.director.GetText())
        item.ReleaseDate = validstr(curShow.releasedate.GetText())

```

and in the XML files we have (for example)

```auto
                <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.

---

<div class="post-metadata">

**Author:** ![dew](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dew](https://forum.developer.roku.com/u/dew)\
**Post date:** [February 2, 2012, 8:54am UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/3 "2012-02-02T08:54:32Z")

</div>

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

Movie title 10011 Classic Film SD mp4 SD 1500 location of video description of film Classic Film THIS FIELD IS ACTUALLY ACTORS ON THE roSpringboard 7200 Need to add this Need to add this but I believe it is a image? Need to add this Need to add this Need to add this

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

---

<div class="post-metadata">

**Author:** ![bandal](https://avatars.discourse-cdn.com/v4/letter/b/c67d28/32.png) [@bandal](https://forum.developer.roku.com/u/bandal)\
**Post date:** [February 2, 2012, 4:28pm UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/4 "2012-02-02T16:28:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dew](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dew](https://forum.developer.roku.com/u/dew)\
**Post date:** [February 3, 2012, 11:34am UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/5 "2012-02-03T11:34:08Z")

</div>

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

```auto
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

```auto
  '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?

```auto
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

```auto
<?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

---

<div class="post-metadata">

**Author:** ![bandal](https://avatars.discourse-cdn.com/v4/letter/b/c67d28/32.png) [@bandal](https://forum.developer.roku.com/u/bandal)\
**Post date:** [February 3, 2012, 6:34pm UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/6 "2012-02-03T18:34:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dew](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dew](https://forum.developer.roku.com/u/dew)\
**Post date:** [February 3, 2012, 8:46pm UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/7 "2012-02-03T20:46:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![belltown](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@belltown](https://forum.developer.roku.com/u/belltown)\
**Post date:** [February 3, 2012, 9:45pm UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/8 "2012-02-03T21:45:31Z")

</div>

Try changing Line 10 of appDetailScreen.brs to:

```auto
screen.SetDescriptionStyle("movie") 

```

---

<div class="post-metadata">

**Author:** ![dew](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dew](https://forum.developer.roku.com/u/dew)\
**Post date:** [February 4, 2012, 12:39pm UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/9 "2012-02-04T12:39:10Z")

</div>

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 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.

```auto
<?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

```auto
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

```auto
 '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

```auto
  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

---

<div class="post-metadata">

**Author:** ![dew](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dew](https://forum.developer.roku.com/u/dew)\
**Post date:** [February 4, 2012, 7:51pm UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/10 "2012-02-04T19:51:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![belltown](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@belltown](https://forum.developer.roku.com/u/belltown)\
**Post date:** [February 5, 2012, 12:09am UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/11 "2012-02-05T00:09:36Z")

</div>

For actors and categories, etc., i.e. any field that can appear more than once, do not use a separate XML element name for each one, use the same element repeated as many times as necessary, e.g:

```auto

<category>Drama</category>
<category>Romance</category>
<category>Mystery</category>
<actor>Sylvia Sidney</actor>
<actor>Oskar Homolka</actor>
<actor>Desmond Tester</actor>

```

In your BrightScript code, read the XML elements using a ‘for each’ loop and Push each item into an array, e.g:

```auto

item.Actors = [] ' Create an array of actors
for each actor in curShow.actor
      item.Actors.Push (validStr (actor.GetText ()))
end for

item.Categories = [] ' Create an array of categories
for each category in curShow.category
      item.Categories.Push (validStr (category.GetText ()))
end for

```

---

<div class="post-metadata">

**Author:** ![dew](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dew](https://forum.developer.roku.com/u/dew)\
**Post date:** [February 5, 2012, 4:29pm UTC](https://forum.developer.roku.com/t/videoplayer-xml-question/1574/12 "2012-02-05T16:29:16Z")

</div>

Thank you belltown, that did it 😄 thank you again for all of your help.  
Cheers  
DEW
