### Copy PyATEMMax Library to Examples Folder (Bash) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Use this command to copy the PyATEMMax library into the examples directory if you haven't installed it. ```bash $ cp -r $(pwd)/PyATEMMax $(pwd)/examples/PyATEMMax ``` -------------------------------- ### Common Example Structure: Welcome Message (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md A standard welcome message printed at the start of example scripts, indicating the script's name and start time. ```python print(f"[{time.ctime()}] PyATEMMax demo script: ping") ``` -------------------------------- ### Install PyATEMMax Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/index.md Install the PyATEMMax library using pip. ```bash pip install PyATEMMax ``` -------------------------------- ### Initialize Logging and Run Main Loop Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scheduled-tasks.md Initializes the Python logging module with a specific format and level, then calls the main function to start the PyATEMMax demo script. This setup ensures that logging output is available from the start of the script execution. ```python # Initialize logging logging.basicConfig( datefmt='%H:%M:%S', level=logging.INFO, format='%(asctime)s.%(msecs)03d %(levelname)-8s [%(name)s] %(message)s') log = logging.getLogger('PyATEMMax-demo') # Run main loop log.info("PyATEMMax demo script starting") main() ``` -------------------------------- ### Common Example Structure: ATEMMax Object Creation (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Instantiating the PyATEMMax.ATEMMax object, which is a common first step after initialization in the example scripts. ```python switcher = PyATEMMax.ATEMMax() ``` -------------------------------- ### Common Example Structure: Constant Initialization (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Example of initializing a constant value, such as a default interval, within an example script. ```python DEFAULT_INTERVAL = 1.0 ``` -------------------------------- ### Stripped-down PyATEMMax example for changing settings Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/change-settings.md A minimal Python script demonstrating how to connect to an ATEM switcher and update its master volume, program, and preview sources. ```python import PyATEMMax switcher = PyATEMMax.ATEMMax() switcher.connect("192.168.1.111") if switcher.waitForConnection(infinite=False): switcher.setAudioMixerMasterVolume(0) switcher.setProgramInputVideoSource(0, 1) switcher.setPreviewInputVideoSource(0, 2) print("Settings updated") else: print("ERROR: no response from switcher") switcher.disconnect() ``` -------------------------------- ### Initialize Script and Argument Parser Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scan-query.md Sets up the script with necessary imports, argument parsing for the IP range, and initial logging. This is the starting point for the scanning logic. ```python #!/usr/bin/env python3 # coding: utf-8 """scan-query.py - PyATEMMax demo script. Part of the PyATEMMax library.""" import argparse import time import PyATEMMax print(f"[{time.ctime()}] PyATEMMax demo script: scan-query") parser = argparse.ArgumentParser() parser.add_argument('range', help='IP address range (e.g) 192.168.1') parser.add_argument('-m', '--mixeffect', help=f'select mix effect (0/1), default 0', type=int, default=0) args = parser.parse_args() print(f"[{time.ctime()}] Scanning network range {args.range}.* for ATEM switchers") ``` -------------------------------- ### Common Example Structure: Docstring (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md A typical docstring format used in PyATEMMax example scripts to describe the script's purpose. ```python """ping.py - PyATEMMax demo script. Part of the PyATEMMax library.""" ``` -------------------------------- ### Common Example Structure: Waiting for Connection (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Pausing script execution until the connection to the ATEM switcher is successfully established after calling the 'connect' method. ```python switcher.waitForConnection() ``` -------------------------------- ### Common Example Structure: Connecting to Switcher (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Establishing a connection to the ATEM switcher using the 'connect' method of the ATEMMax object, typically passing the IP address. ```python switcher.connect(args.ip) ``` -------------------------------- ### Stripped Down Ping Example Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/ping.md A simplified version of the ping utility, demonstrating the essential steps for connecting to and monitoring an ATEM switcher with hardcoded values. ```python import time import PyATEMMax switcher = PyATEMMax.ATEMMax() while True: switcher.ping("192.168.1.111") if switcher.waitForConnection(): print(f"Switcher connected") else: print(f"Switcher DISCONNECTED") switcher.disconnect() time.sleep(1) ``` -------------------------------- ### Common Example Structure: Imports (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Essential import statements commonly found in PyATEMMax example scripts, including 'argparse', 'time', and 'PyATEMMax'. ```python import argparse import time import PyATEMMax ``` -------------------------------- ### Start Scheduler Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scheduled-tasks.md Starts the scheduler to perform tasks at a specified interval. The interval is determined by the 'args.interval' variable. ```python log.info(f"Starting scheduler (every {args.interval}s)") startScheduler(switcher) ``` -------------------------------- ### PyATEMMax Events Script Setup Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/events.md This Python code sets up the PyATEMMax library for event handling, including argument parsing and initial connection messages. ```python #!/usr/bin/env python3 # coding: utf-8 """events.py - PyATEMMax demo script. Part of the PyATEMMax library.""" from typing import Dict, Any import argparse import time import random import PyATEMMax print(f"[{time.ctime()}] PyATEMMax demo script: events") DEFAULT_INTERVAL = 1.0 parser = argparse.ArgumentParser() parser.add_argument('ip', help='switcher IP address') parser.add_argument('-i', '--interval', help=f'wait INTERVAL seconds between changes, default: {DEFAULT_INTERVAL}', default=DEFAULT_INTERVAL, type=float) args = parser.parse_args() print(f"[{time.ctime()}] Changing PGM/PVW on ATEM switcher at {args.ip} every {args.interval} seconds") ``` -------------------------------- ### Create Symbolic Link for PyATEMMax Library (Bash) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Create a symbolic link to the PyATEMMax library in the examples folder. This is useful if you plan to modify the library's code. ```bash $ ln -s $(pwd)/PyATEMMax $(pwd)/examples/PyATEMMax ``` -------------------------------- ### Setting and Getting Audio Master Volume Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/data/state.md Shows how to set the master audio volume in decibels and then retrieve it. ```python switcher.setAudioMixerMasterVolume(1.8) decibels = switcher.audioMixer.master.volume ``` -------------------------------- ### Common Example Structure: Command Line Arguments (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Code for parsing command-line arguments using 'argparse', commonly used in example scripts to accept parameters like IP address and interval. ```python parser = argparse.ArgumentParser() parser.add_argument('ip', help='switcher IP address') parser.add_argument('-i', '--interval', help=f'wait INTERVAL seconds between pings, default: {DEFAULT_INTERVAL}', default=DEFAULT_INTERVAL, type=float) args = parser.parse_args() ``` -------------------------------- ### Run Tally String Example Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/tally-str.md Demonstrates running the tally-str script to monitor tally changes for a specific video source on a given switcher IP address. It shows the connection process and real-time tally updates. ```bash $ python3 tally.py 192.168.1.111 5 [Sat Nov 28 15:39:41 2020] PyATEMMax demo script: tally-str [Sat Nov 28 15:39:41 2020] Connecting to switcher at 192.168.1.111 [Sat Nov 28 15:39:41 2020] Connected, tally 5 is [PVW] [Sat Nov 28 15:39:41 2020] Watching for tally changes on videoSource 5 [Sat Nov 28 15:39:45 2020] tally 5 is [PGM] [Sat Nov 28 15:39:48 2020] tally 5 is [PVW] [Sat Nov 28 15:39:51 2020] tally 5 is [] [Sat Nov 28 15:39:53 2020] tally 5 is [PVW] [Sat Nov 28 15:39:55 2020] tally 5 is [PGM] [Sat Nov 28 15:39:56 2020] tally 5 is [PGM][PVW] [Sat Nov 28 15:39:59 2020] tally 5 is [PGM] [Sat Nov 28 15:40:01 2020] tally 5 is [PGM][PVW] [Sat Nov 28 15:40:05 2020] tally 5 is [PGM] [Sat Nov 28 15:40:06 2020] tally 5 is [PVW] [Sat Nov 28 15:40:08 2020] tally 5 is [] [Sat Nov 28 15:40:12 2020] tally 5 is [PVW] [Sat Nov 28 15:40:14 2020] tally 5 is [PGM] ... ``` -------------------------------- ### Ping ATEM Switcher with Default Interval Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/ping.md This example demonstrates pinging an ATEM switcher at its default interval of 1 second, showing successful connection messages. ```bash $ python3 ping.py 192.168.1.111 [Tue Nov 24 21:52:14 2020] PyATEMMax demo script: ping [Tue Nov 24 21:52:14 2020] Pinging ATEM switcher at 192.168.1.111 every 1.0 seconds [Tue Nov 24 21:52:14 2020] Switcher connected [Tue Nov 24 21:52:15 2020] Switcher connected [Tue Nov 24 21:52:16 2020] Switcher connected ... ``` -------------------------------- ### Common Example Structure: Shebang and Encoding (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Standard shebang and Python source encoding declaration found at the beginning of example scripts. ```python #!/usr/bin/env python3 # coding: utf-8 ``` -------------------------------- ### Python Type Hint Example Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md This example demonstrates Python type hints (PEP 484) for improved type checking and editor support. It shows a function signature with a type hint for the 'switcher' parameter. ```python def changeSwitcherSettings(switcher: PyATEMMax.ATEMMax) -> None: pass ``` -------------------------------- ### Change Switcher Settings (Commented) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scheduled-tasks.md Provides commented-out examples for changing initial ATEM switcher settings like input names and audio levels. Uncomment to enable. ```python def changeSwitcherSettings(switcher: PyATEMMax.ATEMMax) -> None: """Initialize switcher settings after connection""" # Settings can be changed after connection... uncomment to try out # switcher.setInputShortName(1, "PyAM") # switcher.setInputLongName(1, "PyATEMMax rules!") # switcher.setAudioMixerMasterVolume(0.0) # switcher.setAudioMixerInputVolume(switcher.atem.audioSources.input1, 0.0) ``` -------------------------------- ### Initialize scan script and parse arguments Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scan.md Sets up the Python script for scanning ATEM switchers. It includes necessary imports, argument parsing for the IP range, and initial print statements indicating the scan's start. ```python #!/usr/bin/env python3 # coding: utf-8 """scan.py - PyATEMMax demo script. Part of the PyATEMMax library.""" import argparse import time import PyATEMMax print(f"[{time.ctime()}] PyATEMMax demo script: scan") parser = argparse.ArgumentParser() parser.add_argument('range', help='IP address range (e.g) 192.168.1') args = parser.parse_args() print(f"[{time.ctime()}] Scanning network range {args.range}.* for ATEM switchers") ``` -------------------------------- ### Getting Program Input Video Source with Constants Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/data/protocol.md Shows how to retrieve the video source of a program input using ATEM protocol constants for mix effects. ```python switcher.programInput[switcher.atem.mixEffects.mixEffect1].videoSource ``` -------------------------------- ### Initialize ATEMMax object and hit counter Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scan.md Initializes the PyATEMMax object and a counter for found switchers. This is a prerequisite before starting the network scanning loop. ```python switcher = PyATEMMax.ATEMMax() count = 0 ``` -------------------------------- ### Ping ATEM Switcher with Custom Interval Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/ping.md This example shows how to ping an ATEM switcher with a custom interval of 10 seconds, illustrating disconnection messages. ```bash $ python3 ping.py 192.168.1.222 -i 10 [Tue Nov 24 21:52:26 2020] PyATEMMax demo script: ping [Tue Nov 24 21:52:26 2020] Pinging ATEM switcher at 192.168.1.222 every 10.0 seconds [Tue Nov 24 21:52:26 2020] Switcher DISCONNECTED [Tue Nov 24 21:52:36 2020] Switcher DISCONNECTED [Tue Nov 24 21:52:47 2020] Switcher DISCONNECTED ... ``` -------------------------------- ### Getting Program Input Video Source with String Values Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/data/protocol.md Illustrates retrieving the video source of a program input using string representations of ATEM protocol values. ```python switcher.programInput["mixEffect1"].videoSource ``` -------------------------------- ### Getting Program Input Video Source with Integer Values Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/data/protocol.md Demonstrates retrieving the video source of a program input using raw ATEM protocol integer values. ```python switcher.programInput[0].videoSource ``` -------------------------------- ### Scan Network for ATEM Devices (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scan-query.md Use this script to discover ATEM devices on your network. It connects to each IP address, checks for a valid handshake, and retrieves key information like model, volume, and input names. Ensure the PyATEMMax library is installed. ```python import PyATEMMax switcher = PyATEMMax.ATEMMax() for i in range(1,255): ip = f"192.168.1.{i}" print(f"Checking {ip}", end="\r") switcher.connect(ip) if switcher.waitForConnection(infinite=False, waitForFullHandshake=False): if switcher.waitForConnection(infinite=False): pvw = switcher.previewInput[0].videoSource pgm = switcher.programInput[0].videoSource pvwName = switcher.inputProperties[pvw].shortName pgmName = switcher.inputProperties[pgm].shortName print(f"{switcher.atemModel} found at {ip}" f" - Master Volume: {switcher.audioMixer.master.volume}dB" f" - PVW: {pvwName}" f" - PGM: {pgmName}" ) switcher.disconnect() ``` -------------------------------- ### Tally Script Output Example Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/tally.md Shows the expected output when running the tally script, including connection status and tally ON/OFF messages. Observe how tally changes are reported in real-time. ```bash $ 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] ... ``` -------------------------------- ### ATEMConstant Parameter Usage Example Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/methods/index.md Demonstrates the signature of the setProgramInputVideoSource method, highlighting the use of ATEMConstant parameters for mix effects and video sources. It specifies the expected types for the mE and videoSource arguments. ```python setProgramInputVideoSource(mE:ATEMConstant, videoSource:ATEMConstant) -> None ``` -------------------------------- ### Set Clip Player At Beginning Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/methods/set.md Resets the clip player to the beginning of the current clip. Use this to ensure playback starts from the first frame. ```python setClipPlayerAtBeginning(mediaPlayer:ATEMConstant, atBeginning:bool) -> None ``` -------------------------------- ### PyATEMMax with Python Logging Initialized Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/logging/index.md Even with the logging module imported, PyATEMMax is silent by default (CRITICAL level). This example shows how to initialize logging to INFO level for PyATEMMax messages. ```python import PyATEMMax import logging logging.basicConfig( datefmt='%H:%M:%S', level=logging.INFO, format='%(asctime)s.%(msecs)03d %(levelname)-8s [%(name)s] %(message)s') log = logging.getLogger('PyATEMMax-demo') log.info("Starting") switcher = PyATEMMax.ATEMMax() switcher.connect("192.168.1.111") switcher.waitForConnection() log.info("Connected!") switcher.setProgramInputVideoSource(0, "input2") log.info("PGM changed") switcher.disconnect() log.info("Finished") ``` -------------------------------- ### Extracting Enumerated Video Format Name Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/data/state.md Shows multiple ways to get the string representation of the current video format, including using the .name member. ```python formatname = f"Current video format: {switcher.videoMode.format}" ``` ```python formatname = "Current video format: " + str(switcher.videoMode.format) ``` ```python formatname = "Current video format: " + switcher.videoMode.format.name ``` -------------------------------- ### Initialize PyATEMMax and Parse Arguments Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/tally-str.md Sets up the script by importing necessary libraries, defining command-line arguments for IP address and video source, and initializing the PyATEMMax library. ```python #!/usr/bin/env python3 # coding: utf-8 """tally-str.py - PyATEMMax demo script. Part of the PyATEMMax library.""" import argparse import time import PyATEMMax print(f"[{time.ctime()}] PyATEMMax demo script: tally-str") parser = argparse.ArgumentParser() parser.add_argument('ip', help='switcher IP address') parser.add_argument('source', help='video source number', type=int) parser.add_argument('-m', '--mixeffect', help='select mix effect (0/1), default 0', type=int, default=0) args = parser.parse_args() ``` -------------------------------- ### Executing change-settings-multi.py with specific arguments Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/change-settings-multi.md Demonstrates running the script with arguments to set master volume to 0.0dB, select mix effect 1, set program source to 1, and preview source to 2. Shows output including successful updates and connection errors. ```bash $ python3 change-settings-multi.py -v 0.0 -m 1 -p 1 -w 2 [Tue Nov 24 22:51:17 2020] PyATEMMax demo script: change-settings-multi [Tue Nov 24 22:51:17 2020] Changing settings in all switchers [Tue Nov 24 22:51:17 2020] - Master volume: 0.0db [Tue Nov 24 22:51:17 2020] - PGM Video source: 1 on m/e 1 [Tue Nov 24 22:51:17 2020] - PVW Video source: 2 on m/e 1 [Tue Nov 24 22:51:17 2020] Starting settings update [Tue Nov 24 22:51:18 2020] ERROR: no response from 192.168.1.110 [Tue Nov 24 22:51:18 2020] Settings updated on ATEM Television Studio HD at 192.168.1.111 [Tue Nov 24 22:51:19 2020] ERROR: no response from 192.168.1.112 [Tue Nov 24 22:51:20 2020] ERROR: no response from 192.168.1.113 [Tue Nov 24 22:51:21 2020] ERROR: no response from 192.168.1.114 [Tue Nov 24 22:51:22 2020] ERROR: no response from 192.168.1.115 [Tue Nov 24 22:51:22 2020] FINISHED: 1/6 switchers updated. ``` -------------------------------- ### Argument Parsing and Initialization Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/change-settings-multi.md Sets up argument parsing for master volume, preview, and program video sources. Initializes the list of switchers and checks if any arguments were provided. ```python # coding: utf-8 """change-settings-multi.py - PyATEMMax demo script. Part of the PyATEMMax library.""" import argparse import sys import time import PyATEMMax print(f"[{time.ctime()}] PyATEMMax demo script: change-settings-multi") SWITCHERS = [ "192.168.1.110", "192.168.1.111", "192.168.1.112", "192.168.1.113", "192.168.1.114", "192.168.1.115", ] parser = argparse.ArgumentParser() parser.add_argument('-v', '--mastervolume', help=f'master volume (dB)', type=float) parser.add_argument('-w', '--preview', help=f'set preview video source', type=int) parser.add_argument('-p', '--program', help=f'set program video source', type=int) parser.add_argument('-m', '--mixeffect', help=f'select mix effect (0/1), default 0', type=int, default=0) args = parser.parse_args() if args.mastervolume is None and args.program is None and args.preview is None: print(f"[{time.ctime()}] Please specify a value to change (see help)") sys.exit(1) print(f"[{time.ctime()}] Changing settings in all switchers") if args.mastervolume is not None: print(f"[{time.ctime()}] - Master volume: {args.mastervolume}db") if args.program is not None: print(f"[{time.ctime()}] - PGM Video source: {args.program} on m/e {args.mixeffect}") if args.preview is not None: print(f"[{time.ctime()}] - PVW Video source: {args.preview} on m/e {args.mixeffect}") ``` -------------------------------- ### Start Scheduled Task Timer Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scheduled-tasks.md Starts a threading.Timer to execute a function at a specified interval. This is used to repeatedly run scheduled tasks. ```python def startScheduler(switcher: PyATEMMax.ATEMMax) -> None: """Start a timer to run scheduled tasks""" threading.Timer(args.interval, timerFunc, [switcher]).start() ``` -------------------------------- ### Initialize and Connect to ATEM Switcher Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scheduled-tasks.md Initializes the PyATEMMax library, sets the logging level, and connects to the ATEM switcher IP address. Try setting the log level to DEBUG for more detailed output. ```python def main(): """Main loop""" log.info("Initializing switcher") switcher = PyATEMMax.ATEMMax() switcher.setLogLevel(logging.INFO) # Set switcher verbosity (try DEBUG to see more) switcher.connect(args.ip) ``` -------------------------------- ### setClipPlayerPlaying Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/methods/set.md Starts or stops playback for the clip player. ```APIDOC ## setClipPlayerPlaying ### Description Starts or stops playback for the clip player. ### Method ```python setClipPlayerPlaying(mediaPlayer:ATEMConstant, playing:bool) ``` ### Parameters #### Path Parameters - **mediaPlayer** (ATEMConstant) - Required - See ATEMMediaPlayers - **playing** (bool) - Required - On/Off ``` -------------------------------- ### setTransitionStingerPreRoll Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/methods/set.md Sets the pre-roll duration (in frames) for a stinger transition. This determines how much time before the transition starts that the stinger asset is loaded. ```APIDOC ## setTransitionStingerPreRoll ### Description Sets the pre-roll duration (in frames) for a stinger transition. ### Method Python Function ### Parameters #### Arguments * **mE** (ATEMConstant) - see ATEMMixEffects * **preRoll** (int) - frames ### Returns None ``` -------------------------------- ### Execute change-settings script with parameters Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/change-settings.md Runs the change-settings script to update master volume, program, and preview video sources on a specified ATEM switcher IP address. ```bash $ python3 change-settings.py 192.168.1.111 -v 1.7 -p 3 -w 2 [Tue Nov 24 22:37:26 2020] PyATEMMax demo script: change-settings [Tue Nov 24 22:37:26 2020] Changing settings in 192.168.1.111 [Tue Nov 24 22:37:26 2020] - Master volume: 1.7db [Tue Nov 24 22:37:26 2020] - PGM Video source: 3 on m/e 0 [Tue Nov 24 22:37:26 2020] - PVW Video source: 2 on m/e 0 [Tue Nov 24 22:37:26 2020] Starting settings update [Tue Nov 24 22:37:26 2020] Connecting to 192.168.1.111 [Tue Nov 24 22:37:26 2020] Settings updated on ATEM Television Studio HD at 192.168.1.111 ``` -------------------------------- ### Set Clip Player Playing Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/methods/set.md Controls the playback state of the clip player. Set to 'true' to start playback, or 'false' to pause. ```python setClipPlayerPlaying(mediaPlayer:ATEMConstant, playing:bool) -> None ``` -------------------------------- ### ATEMSocket Debug Log Output Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/logging/index.md Example output when ATEMSocket logging is set to DEBUG, showing detailed communication packets and connection status. ```log 01:37:35.586 INFO [PyATEMMax-demo] Starting 01:37:35.590 INFO [ATEMConnectionManager] Starting connection with ATEM switcher on 192.168.1.111 01:37:35.591 DEBUG [ATEMConnectionManager] Event thread started 01:37:35.591 DEBUG [ATEMConnectionManager] Comms thread started 01:37:35.591 DEBUG [ATEMConnectionManager] Started waiting for connection (infinite) 01:37:35.591 INFO [ATEMConnectionManager] Connecting for the first time 01:37:35.591 INFO [ATEMsocket] Connecting to 192.168.1.111:9910 01:37:35.591 INFO [ATEMConnectionManager] Sending HELLO packet 01:37:35.591 DEBUG [ATEMsocket] Sending buffer [10 14 00 00 00 00 00 00 00 3a 00 00 01 00 00 00 00 00 00 00] 01:37:35.595 DEBUG [ATEMsocket] Received 20 new bytes [10 14 00 00 00 00 00 00 00 2f 00 00 02 00 00 08 00 00 00 00] - 20 bytes available 01:37:35.595 DEBUG [ATEMConnectionManager] Basic UDP connection established, switcher is alive. 01:37:35.596 DEBUG [ATEMsocket] Buffer flushed. Data: [02 00 00 08 00 00 00 00] 01:37:35.596 DEBUG [ATEMConnectionManager] Received HELLO. bookStatus 2 connectionCount 8 Extra info: [02 00 00 08 00 00 00 00] 01:37:35.596 INFO [ATEMConnectionManager] Connected to switcher 01:37:35.596 DEBUG [ATEMConnectionManager] Sending HELLO ACK 01:37:35.596 DEBUG [ATEMsocket] Sending buffer [80 0c 00 00 00 00 00 00 00 03 00 00] 01:37:35.604 DEBUG [ATEMsocket] Received 12 new bytes [88 0c 80 08 00 00 00 00 00 00 00 01] - 12 bytes available 01:37:35.604 DEBUG [ATEMConnectionManager] Received new SessionId: 0x8008 01:37:35.604 DEBUG [ATEMsocket] Sending buffer [80 0c 80 08 00 01 00 00 00 00 00 00] 01:37:35.608 DEBUG [ATEMsocket] Received 1388 new bytes [0d 6c 80 08 00 00 00 00 00 00 00 02 00 0c ff ff 5f 76 65 72 00 02 00 1b 00 34 00 00 5f 70 69 6e 41 54 45 4d 20 54 65 6c 65 76 69 73 69 6f 6e 20 53 74 75 64 69 6f 20 48 44 00 00 00 00 10 00 00 4d 50 72 70 00 4f 00 00 08 00 00 00 00 20 01 00 5f 74 6f 70 01 18 02 01 04 02 01 04 01 00 00 01 04 00 00 00 01 01 01 01 00 00 00 00 00 0c c3 00 5f 4d 65 43 00 01 00 00 00 0c 00 00 5f 6d 70 6c 14 00 72 70 00 10 00 00 5f 4d 76 43 01 0a 01 01 00 01 01 01 00 0c 00 00 5f 41 4d 43 0a 00 01 00 00 b4 72 70 5f 56 4d 43 00 0e 00 00 00 10 00 00 00 00 00 80 00 00 00 00 01 00 00 00 00 00 00 40 00 00 00 00 02 57 00 00 00 00 00 80 00 00 00 00 03 50 72 70 00 00 00 40 00 00 00 00 04 10 00 00 00 00 00 10 00 00 00 00 05 00 00 00 00 00 00 20 00 00 00 00 06 5a 00 00 00 00 00 40 00 00 00 00 07 50 72 70 00 00 00 80 00 00 00 00 08 10 ff ff 00 00 01 00 00 00 00 00 09 00 00 00 00 00 02 00 00 00 00 00 0a 5d 00 00 00 00 04 40 00 00 00 00 0b 50 72 70 00 00 08 80 00 00 00 00 0c 10 00 00 00 00 14 40 00 00 00 00 0d 00 00 00 00 00 28 80 00 00 00 00 00 0c 00 00 5f 4d 41 43 64 10 00 00 00 20 72 70 5f 44 56 45 00 00 00 11 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 22 10 00 00 00 0c 72 70 50 6f 77 72 01 00 00 00 00 0c 49 6e 56 69 64 4d 0c 00 13 88 00 0c 00 00 56 33 73 6c 00 50 72 70 00 2c 00 00 49 6e 50 72 00 00 42 6c 61 63 6b 00 50 5a 43 53 00 00 00 00 00 0c 00 00 49 6e 42 6c 6b 00 01 00 01 00 01 00 01 10 13 01 00 2c 72 70 49 6e 50 72 00 01 48 79 70 65 72 64 65 63 6b 00 00 11 00 00 00 00 00 00 00 10 48 50 44 4b 00 70 00 02 00 02 00 00 13 01 00 2c 43 45 49 6e 50 72 00 02 42 61 63 6b 64 72 6f 70 20 49 6e 74 65 72 76 69 65 77 00 00 49 4e 54 57 00 c2 00 02 00 02 00 15 13 01 00 2c 00 00 49 6e 50 72 00 03 42 61 63 6b 64 72 6f 70 20 42 65 61 75 74 79 00 72 70 00 17 42 42 54 59 00 00 00 02 00 02 00 50 13 01 00 2c 00 00 49 6e 50 72 00 04 00 00 4d 50 72 70 00 19 00 00 00 00 00 00 00 10 00 72 4d 50 00 70 00 1a 00 00 00 02 00 02 00 10 13 01 00 2c 72 70 49 6e 50 72 00 05 43 61 6d 65 72 61 20 31 00 70 00 1c 00 00 00 00 00 00 00 10 43 41 4d 31 00 70 00 01 00 01 00 00 13 01 00 2c 53 53 49 6e 50 72 00 06 43 61 6d 65 72 61 20 32 20 2d 20 41 64 72 69 c3 a0 00 00 00 43 41 4d 32 00 00 00 01 00 01 00 20 13 01 00 2c 00 00 49 6e 50 72 00 07 43 61 6d 65 72 61 20 33 20 2d 20 4e 61 6e 64 65 7a 00 00 22 43 41 4d 33 00 00 00 01 00 01 00 50 13 01 00 2c 00 00 49 6e 50 72 00 08 43 61 6d 65 72 61 20 34 00 00 00 00 00 00 00 10 4c 6d 4d 50 43 41 4d 34 00 00 00 01 00 01 00 10 13 01 00 2c 72 70 49 6e 50 72 03 e8 43 6f 6c 6f 72 20 42 61 72 73 00 27 00 00 00 00 00 00 00 10 42 61 72 73 01 70 01 00 01 00 02 00 13 01 00 2c 00 56 49 6e 50 72 07 d1 43 6f 6c 6f 72 20 31 00 01 00 4d 50 72 70 00 2a 00 00 00 00 43 6f 6c 31 01 32 01 00 01 00 03 2b 03 01 00 2c 00 00 49 6e 50 72 07 d2 43 6f 6c 6f 72 20 32 00 00 00 ``` -------------------------------- ### Initialize PyATEMMax and Parse Arguments Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/ping.md This Python code initializes the PyATEMMax library and sets up argument parsing for the IP address and ping interval. ```python #!/usr/bin/env python3 # coding: utf-8 """ping.py - PyATEMMax demo script. Part of the PyATEMMax library.""" import argparse import time import PyATEMMax print(f"[{time.ctime()}] PyATEMMax demo script: ping") DEFAULT_INTERVAL = 1.0 parser = argparse.ArgumentParser() parser.add_argument('ip', help='switcher IP address') parser.add_argument('-i', '--interval', help=f'wait INTERVAL seconds between pings, default: {DEFAULT_INTERVAL}', default=DEFAULT_INTERVAL, type=float) args = parser.parse_args() print(f"[{time.ctime()}] Pinging ATEM switcher at {args.ip} every {args.interval} seconds") ``` -------------------------------- ### Set Transition Stinger Pre Roll Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/methods/set.md Sets the pre-roll duration for stinger transitions in frames. This determines how much time before the transition starts. ```python setTransitionStingerPreRoll(mE:ATEMConstant, preRoll:int) -> None ``` -------------------------------- ### Show change-settings script usage Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/change-settings.md Displays the help message for the change-settings script, outlining available command-line arguments for modifying switcher settings. ```bash $ python3 change-settings.py -h [Tue Nov 24 22:36:06 2020] PyATEMMax demo script: change-settings usage: change-settings.py [-h] [-v MASTERVOLUME] [-w PREVIEW] [-p PROGRAM] [-m MIXEFFECT] ip positional arguments: ip switcher IP address optional arguments: -h, --help show this help message and exit -v MASTERVOLUME, --mastervolume MASTERVOLUME master volume (dB) -w PREVIEW, --preview PREVIEW set preview video source -p PROGRAM, --program PROGRAM set program video source -m MIXEFFECT, --mixeffect MIXEFFECT select mix effect (0/1), default 0 ``` -------------------------------- ### Setting Program Input Video Source with String Values Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/data/protocol.md Illustrates setting the program input video source using string representations of ATEM protocol values. ```python switcher.setProgramInputVideoSource("mixEffect1", "mediaPlayer1") ``` -------------------------------- ### Display Help Message Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/scan-query.md Shows the command-line arguments and their descriptions for the scan-query script. Use this to understand available options. ```bash $ python3 scan-query.py -h [Tue Nov 24 22:28:52 2020] PyATEMMax demo script: scan-query usage: scan-query.py [-h] [-m MIXEFFECT] range positional arguments: range IP address range (e.g) 192.168.1 optional arguments: -h, --help show this help message and exit -m MIXEFFECT, --mixeffect MIXEFFECT select mix effect (0/1), default 0 ``` -------------------------------- ### Setting Program Input Video Source with Integer Values Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/data/protocol.md Demonstrates setting the program input video source using raw ATEM protocol integer values. ```python switcher.setProgramInputVideoSource(0, 3010) ``` -------------------------------- ### Initialize a single ATEMMax object Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/methods/init.md Import the PyATEMMax library and create a new ATEMMax object to control a switcher. ```python import PyATEMMax switcher = PyATEMMax.ATEMMax() ``` -------------------------------- ### Tally Script Initialization Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/tally.md Sets up argument parsing for IP address and video source, and imports necessary libraries. This forms the initial part of the tally monitoring script. ```python #!/usr/bin/env python3 # coding: utf-8 """tally.py - PyATEMMax demo script. Part of the PyATEMMax library.""" import argparse import time import PyATEMMax print(f"[{time.ctime()}] PyATEMMax demo script: tally") parser = argparse.ArgumentParser() parser.add_argument('ip', help='switcher IP address') parser.add_argument('source', help='video source number', type=int) parser.add_argument('-m', '--mixeffect', help=f'select mix effect (0/1), default 0', type=int, default=0) args = parser.parse_args() ``` -------------------------------- ### Command Line Arguments for change-settings-multi.py Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/change-settings-multi.md Displays the available command-line arguments for the script, including options for master volume, preview and program sources, and mix effect selection. ```bash $ python3 change-settings-multi.py -h [Tue Nov 24 22:50:20 2020] PyATEMMax demo script: change-settings-multi usage: change-settings-multi.py [-h] [-v MASTERVOLUME] [-w PREVIEW] [-p PROGRAM] [-m MIXEFFECT] optional arguments: -h, --help show this help message and exit -v MASTERVOLUME, --mastervolume MASTERVOLUME master volume (dB) -w PREVIEW, --preview PREVIEW set preview video source -p PROGRAM, --program PROGRAM set program video source -m MIXEFFECT, --mixeffect MIXEFFECT select mix effect (0/1), default 0 ``` -------------------------------- ### Setting and Getting Camera Control Hue Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/data/state.md Demonstrates setting the hue for a camera and then retrieving it. Hue values are mapped from a raw range to 0.0 to 359.9 degrees. ```python switcher.setCameraControlHue("camera1", 90.5) hue = self.data.cameraControl["camera1"].hue ``` -------------------------------- ### execAutoME Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/methods/exec.md Executes an auto mix effect transition on a specified ME. ```APIDOC ## execAutoME ### Description Executes an auto mix effect transition on a specified ME. ### Method execAutoME ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **mE** (ATEMConstant) - Required - see ATEMMixEffects ``` -------------------------------- ### setSuperSourceForeground Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/methods/set.md Enables or disables the SuperSource foreground. ```APIDOC ## setSuperSourceForeground ### Description Enables or disables the SuperSource foreground. ### Method Signature `setSuperSourceForeground(foreground: bool) -> None` ### Parameters - **foreground** (bool): Set to `True` to enable, `False` to disable. ``` -------------------------------- ### Common Example Structure: Disconnecting from Switcher (Python) Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/examples/index.md Closing the connection to the ATEM switcher using the 'disconnect' method, typically performed at the end of the script's operations. ```python switcher.disconnect() ``` -------------------------------- ### Setting Program Input Video Source with Constants Source: https://github.com/clvlabs/pyatemmax/blob/master/docs/docs/data/protocol.md Shows how to set the program input video source using ATEM protocol constants for mix effects and video sources. ```python switcher.setProgramInputVideoSource(switcher.atem.mixEffects.mixEffect1, switcher.atem.videoSources.mediaPlayer1) ```