summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-06-30 15:38:39 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-06-30 15:38:39 +0300
commitf2d94cd93eb5fa55790f44f66a2ac206eeeeb5e1 (patch)
treef8235ca08b52e4c969879077c4203047d93d731c
parent5bb9e774477802d7f04869a41521f934fc4f1ba4 (diff)
sound_sensor_server: fix for non-exisiting sensor_to_camera_nodes_relations
-rwxr-xr-xsrc/sound_sensor_server.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sound_sensor_server.py b/src/sound_sensor_server.py
index 90e5993..c63d14a 100755
--- a/src/sound_sensor_server.py
+++ b/src/sound_sensor_server.py
@@ -19,9 +19,12 @@ server: SoundSensorServer
def get_related_nodes(node_type: MediaNodeType,
sensor_name: str) -> List[str]:
- if sensor_name not in config[f'sensor_to_{node_type.name.lower()}_nodes_relations']:
- raise ValueError(f'unexpected sensor name {sensor_name}')
- return config[f'sensor_to_{node_type.name.lower()}_nodes_relations'][sensor_name]
+ try:
+ if sensor_name not in config[f'sensor_to_{node_type.name.lower()}_nodes_relations']:
+ raise ValueError(f'unexpected sensor name {sensor_name}')
+ return config[f'sensor_to_{node_type.name.lower()}_nodes_relations'][sensor_name]
+ except KeyError:
+ return []
def get_node_config(node_type: MediaNodeType,