summaryrefslogtreecommitdiff
path: root/switcher.py
diff options
context:
space:
mode:
authorFranziska Kunsmann <hi@kunsmann.eu>2023-05-01 15:39:52 +0200
committerFranziska Kunsmann <hi@kunsmann.eu>2023-05-01 15:39:52 +0200
commitb3c36ce799d4368d4c228426a8a547e26aa095d6 (patch)
treef536b40d832736b24885945a8a5f0b1fbf6ca473 /switcher.py
parente7b773148b86676414419d76a4b40c4201b18d87 (diff)
switcher: only rename inputs if they actually need renaming
Diffstat (limited to 'switcher.py')
-rw-r--r--switcher.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/switcher.py b/switcher.py
index e4387a2..3959445 100644
--- a/switcher.py
+++ b/switcher.py
@@ -71,15 +71,18 @@ class PyATEMSwitcher:
self.atem.setVideoModeFormat(video_mode)
if conf.get("inputs", None):
- try:
- for key, name in conf["inputs"].items():
+ for key, name in conf["inputs"].items():
+ try:
input_number = getattr(self.atem.atem.videoSources, key)
+ long_name = self.atem.inputProperties[input_number].longName
+ if name == long_name:
+ continue
self.log.debug(f"setting input {input_number} to name '{name}'")
self.atem.setInputLongName(input_number, name)
self.atem.setInputShortName(input_number, name[0:4].upper())
- except Exception as e:
- self.log.error("An error occurred while trying to adjust input names")
- self.log.exception(e)
+ except Exception as e:
+ self.log.error("An error occurred while trying to adjust input names")
+ self.log.exception(e)
def _validate_config(self):
if "ip" not in self.config: