diff options
| author | Sophie Schiller <sophie.schiller01@gmail.com> | 2023-05-01 14:26:46 +0200 |
|---|---|---|
| committer | Sophie Schiller <sophie.schiller01@gmail.com> | 2023-05-01 14:26:46 +0200 |
| commit | eddde71c3969888195c5758cced40a6afa007069 (patch) | |
| tree | 0bb8b2c436b5e00e33d53cffaa990ed995ecee7d | |
| parent | 08a20d02065db4c55d9dfa57225b2329a3d9225e (diff) | |
allow renaming an arbitrary count of inputs
| -rw-r--r-- | config.toml | 19 | ||||
| -rw-r--r-- | switcher.py | 13 |
2 files changed, 22 insertions, 10 deletions
diff --git a/config.toml b/config.toml index 31289ab..8256646 100644 --- a/config.toml +++ b/config.toml @@ -3,10 +3,21 @@ ip = "10.73.4.40" video_mode = "1080p25" [atem.settings.inputs] -hdmi1 = "Laptop" -hdmi2 = "Kamera" -hdmi3 = "VGA" -hdmi4 = "Infobeamer" +1 = "Laptop" +2 = "Kamera" +3 = "VGA" +4 = "Infobeamer" +# 5 ... 40 further HDMI/SDI Inputs +# 1000 = 'colorBars' +# 2001 = 'color1' +# 2002 = 'color2' +# 3010 = 'mediaPlayer1' +# 3011 = 'mediaPlayer1Key' +# 3020 .. 3040 further media players +# 3021 .. 3041 further media plaer keys +# 4010 = 'key1Mask' +# ... and a gazillion more inputs + [gtk-settings] gtk-application-prefer-dark-theme = true 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: |
