Facility Control

 View Only
  • 1.  Help with parsing RSS feed as well as json PUT request

    Posted 07-28-2020 17:41

    Hi,

    Not sure if this is the right place to ask, since I am not trying to control any Ross product with what I am doing, just trying to leverage the Dashboard platform for something else.

    I should preface this all by saying that I have very little programming knowledge and try to stick with the visual logic when possible.

    PART 1:

    Parse online-RSS feed for one element.

    Example Feed (tried to put this in the code format but wouldn't work):

    <rss xmlns:psg="http://<my-server-ip>:80/psg_namespace/" version="2.0">

    <channel>
    <title>Channel 4</title>
    <description>Broadcast Channel 4</description>
    <item>
    <title>Access on Location (NC)</title>
    <pubDate>Tue, 28 Jul 2020 11:34:00 -0600</pubDate>
    <psg:eventId>23545</psg:eventId>
    <psg:duration>3600</psg:duration>
    <psg:end_datetime>Tue, 28 Jul 2020 12:34:00 -0600</psg:end_datetime>
    <psg:programCode/>
    <psg:episode>Hudson Bay Dance Ce </psg:episode>
    <psg:episodeCode/>
    <psg:thumbnail>http://<my-server-ip>/thumbnails/2058.jpg?1595954043</psg:thumbnail>
    <psg:mediumId/>
    <vodURL/>
    <description/>
    <link>http://10.10.10.10</link>
    <guid>AC1F6BB4416C-23545</guid>
    </item>
    </channel>

    </rss>

     

    So what I am trying to do is to read the data from the "psg:eventId" line, and assign that to a parameter for me to do stuff with.

    Trying with visual logic, I can't seem to get it working at all, the best I get is for the param to display something like "org.apache.xerces.dom.DeepNodeListlmpl@[random string]" (With the random string changing each time I push the button to read it)

    I did download the XML Example grid from Dashboard U (and watched the video of course), and I have managed to change the coding of the "Ross RSS" button to load my feed, and in the debugger I can see it load successfully. Furthermore, I am able to change the data fields it looks at and get the correct data from it.... HOWEVER, when I try the "psg:eventID" field it seems to break everything. Same with any other psg: field.... so I'm wondering if it is even possible to get that line into dashboard or if the colon in the formatting just makes everything not work. As I said, it seems to work with pulling data from those elements without colons in the name.

     

    PART 2:

    I need to send a "PUT request" with the following format

    "http://<my-server-ip>/events/<psg:eventId>/unschedule.json"

    Using Visual Logic I did find the "HTTP ASync Message" block... not sure if that is what I need, but I chose the method "PUT" and the contentType as "application/json".... just not sure if I need to put the command in the url or data field.... neither seem to work at the moment.

     

    If anyone feels nice enough to help, it would be welcome, if not, just carry on.



  • 2.  RE: Help with parsing RSS feed as well as json PUT request

    Posted 07-30-2020 16:20

    Well, through a lot of googling, learning about namespace, and trial and error with not really knowing what I was doing, I managed to get part 1 to work with the following code, which I figure I will put here in case anyone else is ever looking for a solution to something like this:

    var rss = ogscript.parseXML('http://<my-server-ip>/xml/now_playing?channel=4');
    var search = '//*[local-name()="eventId"]';
    var nodelist = ogscript.runXPath(search, rss);
    ogscript.debug("eventId: " + nodelist.item(0).textContent);
    params.setValue('Channel_1_ID', 0, nodelist.item(0).textContent);

     

    Now onto trying to see if I can figure out part 2!


    #DashBoard