Search code examples
rokubrightscript

Brightsign, how to write a custom parser


I am trying to write a custom parser for the XD1030 Brightsign player. This is the the only sample code that I got. I think it works, but as it doesn't output anything anywhere I can't really tell.

Sub rss(xmlFileName$ as String, itemsByIndex as object, itemsByTitle as Object, userVariables As Object)

  xml = CreateObject("roXMLElement") 
  if not xml.Parse(ReadAsciiFile(xmlFileName$)) then 
      print "xml read failed" 
  else 
      if type(xml.channel.item) = "roXMLList" then 
          index% = 0 

          for each itemXML in xml.channel.item 
              itemsByIndex.push(stri(index%) + " - " + itemXML.description.GetText())
              index% = index% + 1
          next 
      endif 
  endif 
end Sub

The documentation is lacking and the debugging possibilities are not that great either. I have managed to create a file on the SD-card and written log messages to it, but as soon as the player tries to run invalid code it either stop executing the code or starts to flash the red error LED (which means that I have to reconfigure the player).

What I am really after is a very small custom parser that actually does something, i.e. takes an RSS feed, does something to it and displays it on the screen. Just something so that I have something to go on.

The end goal is to parse a more complex XML feed that contains images and videos which should be displayed as a kind of slide show, the feed should be able to contain parameters that the script uses to set user variables specified in the presentation.


Solution

  • Take a look at the BrightSign repositories on Github,
    they have lots of examples. https://github.com/brightsign

    I'm also looking at setting user variables from an RSS,
    and think this might be a good starting point for this
    https://github.com/brightsign/BrightAuthor-Parser-Scripts/tree/master/URL-Change