This example is a quick demonstration on how to get tally information for an input source.
$ python3 tally.py -h
[Tue Nov 24 22:06:23 2020] PyATEMMax demo script: tally
usage: tally.py [-h] [-m MIXEFFECT] ip source
positional arguments:
ip switcher IP address
source video source number
optional arguments:
-h, --help show this help message and exit
-m MIXEFFECT, --mixeffect MIXEFFECT
select mix effect (0/1), default 0
It connects to the specified switcher and keeps listening for PGM changes to show tally changes for the selected source:
$ python3 tally.py 192.168.1.111 5
[Tue Nov 24 22:07:23 2020] PyATEMMax demo script: tally
[Tue Nov 24 22:07:23 2020] Connecting to switcher at 192.168.1.111
[Tue Nov 24 22:07:23 2020] Connected, tally 5 is [OFF]
[Tue Nov 24 22:07:23 2020] Watching for tally changes on videoSource 5
[Tue Nov 24 22:07:26 2020] Tally 5 [ON]
[Tue Nov 24 22:07:29 2020] Tally 5 [OFF]
[Tue Nov 24 22:07:41 2020] Tally 5 [ON]
[Tue Nov 24 22:07:41 2020] Tally 5 [OFF]
...
Code walkthrough
Start with the usual initial steps (explained in Examples)
Connect to the switcher and wait for the connection process to finish:
Once it’s connected to the switcher it can get information on the selected videoSource for PGM.
To do this, it reads the provided programInput.videoSource for the selected mixEffect:
From this point on, the script just keeps on asking for the same data and comparing it to see if it has changed.