summaryrefslogtreecommitdiff
path: root/switcher.py
diff options
context:
space:
mode:
authorSophie Schiller <sophie.schiller01@gmail.com>2023-05-01 14:26:46 +0200
committerSophie Schiller <sophie.schiller01@gmail.com>2023-05-01 14:26:46 +0200
commiteddde71c3969888195c5758cced40a6afa007069 (patch)
tree0bb8b2c436b5e00e33d53cffaa990ed995ecee7d /switcher.py
parent08a20d02065db4c55d9dfa57225b2329a3d9225e (diff)
allow renaming an arbitrary count of inputs
Diffstat (limited to 'switcher.py')
-rw-r--r--switcher.py13
1 files changed, 7 insertions, 6 deletions
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: