From eddde71c3969888195c5758cced40a6afa007069 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Mon, 1 May 2023 14:26:46 +0200 Subject: allow renaming an arbitrary count of inputs --- switcher.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'switcher.py') diff --git a/switcher.py b/switcher.py index 6454850..31b5933 100644 --- a/switcher.py +++ b/switcher.py @@ -2,7 +2,7 @@ import logging import PyATEMMax from PyATEMMax.ATEMProtocolEnums import ATEMVideoModeFormats, ATEMTransitionStyles - +from rich import inspect VIDEO_FORMATS = { f[1:] for f in dir(ATEMVideoModeFormats) @@ -74,11 +74,12 @@ class PyATEMSwitcher: self.atem.setVideoModeFormat(video_mode) if conf.get('inputs', None): - for i in range(1,5): - input_name = conf['inputs'][f'hdmi{i}'] - self.log.debug(f"setting input {i} to name '{input_name}'") - self.atem.setInputLongName(i, input_name) - self.atem.setInputShortName(i, input_name[0:3]) + for inp in self.atem.atem.videoSources: + if conf['inputs'].get(inp.value, None): + new_name = conf['inputs'][inp.value] + self.log.debug(f"setting input {inp.value} to name '{new_name}'") + self.atem.setInputLongName(inp.value, new_name) + self.atem.setInputShortName(inp.value, new_name[0:3]) def _validate_config(self): if 'ip' not in self.config: -- cgit v1.2.3