The Python SCTE plugin allows you to use a python file with specific functions defined to hook into SCTE processing and control slicer state. You will need to add two parameters to your config file:
scte_type: python scte_module: scte_example
scte_module should be the name of the python file in the slicer's /plugins directiry minus the extension. (plugins/scte_example.py will be scte_example)
To reference an absolute path outside of the slicer directory, include the .py extension:
scte_type: python scte_module: /Users/tyler/plugin_directory/tylers_plugin.py
Python 2.7 and its libraries must be installed to your system's shared library path. By default, it is included with Mac OS X and Ubuntu versions 14.04 LTS or lower. Please verify that Python 2.7 has been installed when using Ubuntu 16.04 or higher.
Encrypted plugins are configured the same way as plaintext plugins... However their name is the SHA-1 hash of the plaintext plugin. i.e. scte_example.py would be the plaintext version and B1487EF85E26CA04BF0350D46B2E4509EB93A298.py would be the encrypted version. To use an encrypted python plugin, you still reference it's unhashed name. To use B1487EF85E26CA04BF0350D46B2E4509EB93A298.py you would use the same scte_module: scte_example configuration. If you have both a plaintext and encrypted plugin for the same module, the plaintext will take precedence.
The most basic plugin, which does nothing, must appear as:
import slicer def Initialize(): return slicer.Initialize()
This function is necessary to establish proper communication between the plugin and the slicer. The second, optional, function is where you perform SCTE logic:
def Process35(slice_info): slicer.Blackout(long(0)) return long(0)
This function receives the SCTE35 packets and inside you may inspect the slice_info object containing the SCTE packet or call slicer module functions to control the slicer. (Note that SCTE104 packets are converted to SCTE35 and passed to this function for unified handling of SCTE.)
The slicer module provides a way for your plugin to call functions and manipulate slicer state.
This function should only be called by the Initialize() function as shown above.
Returns the current slicer state as a string
print slicer.GetState() #Returns one of: #start_blackout - Slicer is in initial blackout mode. #slicing - slicer is currently slicing #adbreak - Slicer is in ad break #replace - Slicer is in replace content mode #blackout - Slicer is in Blackout
Used to initiate blackout.
Used to start a new asset. Description and External ID are optional.
print slicer.ContentStart(long(pts), "Description", "External ID")
Start an ad break. Duration is optional. If omitted you must call AdEnd() to end a break.
print slicer.AdStart(long(pts), long(duration))
End an ad break explicitly.
Adds metadata to an ad break. Ad meta is specific to the break it's being added to, not global for all breaks. You should call AdMeta BEFORE starting the ad break it is to apply to.
print slicer.AdMeta("key", "value")
Adds metadata to the currently slicing asset. This will show up in the CMS under the asset's metadata.
print slicer.Metadata("key", "value")
Start an asset boundary. If a boundary is already active, this is ignored. Duration is optional. You must call EndBoundary() to end a boundary.
print slicer.StartBoundary(long(pts), name, long(duration))
End an asset boundary. If no boundary is active, then this is ignored.