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

Brightscript "Compilation Failed"

Hello, I'm trying to modify a section of code to add an If statement if title = example but getting that error when trying to side load to my Roku;

If inExtinf
maPath = rePath.Match (line)
If maPath.Count () = 2
path = maPath [1]
m3u8List.Push ({
Title: title,
Length: length,
HDPosterUrl: "pkg:/images/HD/" + title + ".jpg",
SDPosterUrl: "pkg:/images/SD/" + title + ".jpg",
If Title = "Example"
ShortDescriptionLine1: "Example 1",
ShortDescriptionLine2: "Example 2",
Endif
Stream: {Url: path + streamid}
bitrate: 0
StreamFormat: "hls"
SwitchingStrategy: "full-adaptation"
})
inExtinf = False
Endif
Endif


it just reads a M3U file and the "HDPosterUrl: "pkg:/images/HD/" + title + ".jpg"," part works and grabs the correct image depending on the title that is fed through but now I'm trying to add a few If statements to display a different "ShortDescriptionLine1" depending on the title but not working. Probably have the syntax wrong Smiley Sad

I wish there was a program you could run the script through to check for errors before zipping and installing on the Roku.
0 Kudos
4 Replies
Highlighted
Roku Employee
Roku Employee

Re: Brightscript "Compilation Failed"

"JamesChannel" wrote:
Hello, I'm trying to modify a section of code to add an If statement if title = example but getting that error when trying to side load to my Roku;

If inExtinf
maPath = rePath.Match (line)
If maPath.Count () = 2
path = maPath [1]
m3u8List.Push ({
Title: title,
Length: length,
HDPosterUrl: "pkg:/images/HD/" + title + ".jpg",
SDPosterUrl: "pkg:/images/SD/" + title + ".jpg",
If Title = "Example"
ShortDescriptionLine1: "Example 1",
ShortDescriptionLine2: "Example 2",
Endif
Stream: {Url: path + streamid}
bitrate: 0
StreamFormat: "hls"
SwitchingStrategy: "full-adaptation"
})
inExtinf = False
Endif
Endif


it just reads a M3U file and the "HDPosterUrl: "pkg:/images/HD/" + title + ".jpg"," part works and grabs the correct image depending on the title that is fed through but now I'm trying to add a few If statements to display a different "ShortDescriptionLine1" depending on the title but not working. Probably have the syntax wrong Smiley Sad

I wish there was a program you could run the script through to check for errors before zipping and installing on the Roku.


You can't insert the code
If Title = "Example"

in the middle of the associative array literal value definition that is being passed to m3u8List.Push.

Perhaps you could phrase it as:

If inExtinf
maPath = rePath.Match (line)
If maPath.Count () = 2
path = maPath [1]
aa = {
Title: title,
Length: length,
HDPosterUrl: "pkg:/images/HD/" + title + ".jpg",
SDPosterUrl: "pkg:/images/SD/" + title + ".jpg",
Stream: {Url: path + streamid}
bitrate: 0
StreamFormat: "hls"
SwitchingStrategy: "full-adaptation"
}
If title = "Example"
aa.ShortDescriptionLine1 = "Example 1"
aa.ShortDescriptionLine2 = "Example 2"
Endif
m3u8List.Push (aa)
inExtinf = False
Endif
Endif
0 Kudos
JamesChannel
Level 7

Re: Brightscript "Compilation Failed"

Okay, thank you for getting back to me.

So I can just do this if i want to include more outcomes ?;

If title = "Example"
aa.ShortDescriptionLine1 = "Example 1"
aa.ShortDescriptionLine2 = "Example 2"
Endif
If title = "ExampleOne"
aa.ShortDescriptionLine1 = "Example One"
aa.ShortDescriptionLine2 = "Example One2"
Endif
If title = "ExampleTwo"
aa.ShortDescriptionLine1 = "Example Two"
aa.ShortDescriptionLine2 = "Example Two2"
Endif
m3u8List.Push (aa)
0 Kudos
Roku Employee
Roku Employee

Re: Brightscript "Compilation Failed"

Yep.

(You could use If/Else If/Else clauses if you wanted).
0 Kudos
JamesChannel
Level 7

Re: Brightscript "Compilation Failed"

Okay, I'll give it a try tonight. Thx
0 Kudos