Viz Pilot User Guide

Version 8.7 | Published September 25, 2023 ©

Update Script Editor

The Update Script Editor lets you add scripts that will be executed by update services on the server side, and not on the client side through Director.

Unlike the Live Update mechanism that relies on Director executing the scripts, update services work on the Media Sequencer alone, and are therefore available to all products connected to the Media Sequencer.

The Update Script Editor does not have access to components in the template, only the data, so the template does not need to be loaded by Director (as is the case for Live Update scripts).

This section contains the following topics:

Using the Update Script Editor

The Update Script Editor consists of the Script and Actions tabs.

Script

images/download/attachments/68857408/twgeneral_updatescript_editor.png

The Script tab lets you select which of the Update Services you want to use. Either Viz Pilot system’s own Update Service or an external (third party) update service.

Actions

images/download/attachments/68857408/twgeneral_updatescript_actions.png

The Actions tab lets you select which actions are triggered during an update and set the timeout for each action.

Script actions are based on Read, Take, Cue and Update events that are triggered on the Media Sequencer.

When the Take action is selected, the Update at regular intervals while on air option is enabled. If this is checked, the Media Sequencer will periodically send updates to the update service. The interval is specified by the parameter live_update_interval, and the minimum value is 2 seconds.

Note: Update at regular intervals while on air is only available if Template Wizard is connected to a database with schema Viz Pilot 6.0 or later, and Media Sequencer 3.0 or later.

Update Services

Update services are mechanisms that let the template designer decide when to update data in the template, and which fields to update. This is useful for data that must be updated right before going on air. Typical examples are stock prices, player statistics etc.

images/download/attachments/68857408/twgeneral_updateservice.png


In Template Wizard you have two options:

  1. Viz Pilot’s Update Service (Script Runner): This mechanism lets you write a script to update the data that will be run by Script Runner during playout.

  2. External update service: Alternatively, you can point the template (no script) to an external update service (for example third party), that can return updated data using the Viz Data Format (VDF). In order to implement an external update service, you need to parse and return a VDF document to the Media Sequencer. The document is posted to the external update service by the Media Sequencer.

    images/download/attachments/68857408/twgeneral_updateservice_external.png

Update Service Scripting

The entry point for using Viz Pilot’s update service (Script Runner) is a method called OnUpdatePayload. The method has the following signature: Sub OnUpdatePayload(Data).

The Data parameter contains the incoming data and the data can be modified in the OnUpdatePayload script.

Properties and Methods

Data Properties

Description

Data.Count

Number of fields in the Data.

Data.FieldAt(index)

Returns a PayloadField at the given index.

Data("1")

Returns the PayloadField with the given name. "1" in this example.

PayloadField properties

Description

Name

The name of the field.

Value

The name of the field.

Example

A sample script that updates all the incoming fields and set their values to “New value from script”:

Sub OnUpdatePayload(Data)
For i=0 to Data.Count-1
Set field = Data.FieldAt(i)
field.Value = "New value from script"
Next
End Sub

Tip: Data treated outside the OnUpdatePayload function (for example fetching external data from files or databases) must be returned before the OnUpdatePayload function ends.

Viz Data Format (VDF)

Viz Data Format (VDF) refers to format specifications created for the purpose of data interchange between Vizrt software components. VDF forms the basis of integration points, interoperability, reusable components and content portability.

The Viz Data Format (VDF) Payload and Model Specification can be accessed in the Web Interface section of the Viz Pilot Data Server Administrator Guide.

Example VDF

<?xml version="1.0" encoding="utf-8"?>
<payload model="http://localhost:8177/templates/18110/model" xmlns="http://www.vizrt.com/types">
<field name="-concept-variant-choice">
<field name="concept">
<value>Demo</value>
</field>
<field name="variant">
<value>Default</value>
</field>
</field>
<field name="1">
<value>Pilot</value>
</field>
<field name="2">
<value>rocks :)</value>
</field>
</payload>