freemocap / skellycam

The camera back-end for the `freemocap` project - or - An easy and efficient way to connect to one or more cameras and record synchronized videos💀📸
GNU Affero General Public License v3.0
19 stars 5 forks source link

Fix camera config validation #60

Closed philipqueen closed 1 week ago

philipqueen commented 3 weeks ago

Fixes a Pydantic validation error where we were setting an int field to None, breaking the camera config setting.

Representative error from Discord:

[2024-08-10T16:40:27.619482] [Δt:0.942122s] [    INFO] [skellycam.gui.qt.widgets.skelly_cam_config_parameter_tree_widget] [skelly_cam_config_parameter_tree_widget:_extract_dictionary_of_camera_configs():208] [PID:20124:MainProcess TID:17372:MainThread ] Extracting camera configs from parameter tree
2024-08-10 16:40:27,619 - skellycam.gui.qt.widgets.skelly_cam_config_parameter_tree_widget - INFO - Extracting camera configs from parameter tree
Traceback (most recent call last):
  File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\skellycam\gui\qt\widgets\skelly_cam_config_parameter_tree_widget.py", line 139, in _emit_camera_configs_dict
    camera_configs_dictionary = self._extract_dictionary_of_camera_configs()
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\skellycam\gui\qt\widgets\skelly_cam_config_parameter_tree_widget.py", line 214, in extractdictionaryofcamera_configs
    camera_config_dictionary[camera_id] = CameraConfig(
                                          ^^^^^^^^^^^^^
  File "C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\pydantic\main.py", line 193, in __init
    self.__pydantic_validator.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for CameraConfig
rotate_video_cv2_code
  Input should be a valid integer [type=int_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.8/v/int_type