diff options
Diffstat (limited to 'switcher.py')
| -rw-r--r-- | switcher.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/switcher.py b/switcher.py index 31b5933..4262846 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,12 +74,11 @@ class PyATEMSwitcher: self.atem.setVideoModeFormat(video_mode) if conf.get('inputs', None): - 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]) + for key, name in conf['inputs'].items(): + input_number = getattr(self.atem.atem.videoSources, key) + self.log.debug(f"setting input {input_number} to name '{name}'") + self.atem.setInputLongName(input_number, name) + self.atem.setInputShortName(input_number, name[0:3]) def _validate_config(self): if 'ip' not in self.config: |
