Forum Discussion

JamesChannel's avatar
10 years ago

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 😞

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

4 Replies

  • RokuKC's avatar
    RokuKC
    Roku Employee
    "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 😞

    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
  • 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)
  • RokuKC's avatar
    RokuKC
    Roku Employee
    Yep.

    (You could use If/Else If/Else clauses if you wanted).