summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSophie Schiller <sophie.schiller01@gmail.com>2023-05-01 14:44:11 +0200
committerSophie Schiller <sophie.schiller01@gmail.com>2023-05-01 14:44:11 +0200
commitf317e0ee068fd8f018868a1eaa6e8c1b6f604cd9 (patch)
treee634c9fcb49f0a9b38942966a4b7dfa41113bbf3
parenteddde71c3969888195c5758cced40a6afa007069 (diff)
rename inputs on startup
-rw-r--r--config.toml19
-rw-r--r--switcher.py13
2 files changed, 10 insertions, 22 deletions
diff --git a/config.toml b/config.toml
index 8256646..7d5bfea 100644
--- a/config.toml
+++ b/config.toml
@@ -3,21 +3,10 @@ ip = "10.73.4.40"
video_mode = "1080p25"
[atem.settings.inputs]
-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
-
+input1 = "Laptop"
+input3 = "Kamera"
+input2 = "VGA"
+input4 = "Infobeamer"
[gtk-settings]
gtk-application-prefer-dark-theme = true
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: