From 08a20d02065db4c55d9dfa57225b2329a3d9225e Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Mon, 1 May 2023 13:47:22 +0200 Subject: rename inputs on startup --- config.toml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'config.toml') diff --git a/config.toml b/config.toml index 4e3f0ea..31289ab 100644 --- a/config.toml +++ b/config.toml @@ -1,15 +1,18 @@ [atem] -ip = '10.73.96.40' -video_mode = '1080p50' +ip = "10.73.4.40" +video_mode = "1080p25" -[atem.settings] +[atem.settings.inputs] +hdmi1 = "Laptop" +hdmi2 = "Kamera" +hdmi3 = "VGA" +hdmi4 = "Infobeamer" +[gtk-settings] +gtk-application-prefer-dark-theme = true +gtk-theme-name = "Adwaita" [logging] -# see https://docs.python.org/3/library/logging.html#levels -level = 10 -format = '%(name)25s [%(levelname)-8s] %(message)s' +format = "%(name)25s [%(levelname)-8s] %(message)s" +level = "DEBUG" -[gtk-settings] -gtk-theme-name = "Adwaita" -gtk-application-prefer-dark-theme = true -- cgit v1.2.3 From eddde71c3969888195c5758cced40a6afa007069 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Mon, 1 May 2023 14:26:46 +0200 Subject: allow renaming an arbitrary count of inputs --- config.toml | 19 +++++++++++++++---- switcher.py | 13 +++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'config.toml') 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: -- cgit v1.2.3 From f317e0ee068fd8f018868a1eaa6e8c1b6f604cd9 Mon Sep 17 00:00:00 2001 From: Sophie Schiller Date: Mon, 1 May 2023 14:44:11 +0200 Subject: rename inputs on startup --- config.toml | 19 ++++--------------- switcher.py | 13 ++++++------- 2 files changed, 10 insertions(+), 22 deletions(-) (limited to 'config.toml') 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: -- cgit v1.2.3