diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-06-30 15:38:39 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-06-30 15:38:39 +0300 |
commit | f2d94cd93eb5fa55790f44f66a2ac206eeeeb5e1 (patch) | |
tree | f8235ca08b52e4c969879077c4203047d93d731c | |
parent | 5bb9e774477802d7f04869a41521f934fc4f1ba4 (diff) |
sound_sensor_server: fix for non-exisiting sensor_to_camera_nodes_relations
-rwxr-xr-x | src/sound_sensor_server.py | 9 |
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, |