From b3c36ce799d4368d4c228426a8a547e26aa095d6 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Mon, 1 May 2023 15:39:52 +0200 Subject: switcher: only rename inputs if they actually need renaming --- switcher.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'switcher.py') 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: -- cgit v1.2.3