diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2024-02-17 23:20:49 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2024-02-17 23:20:49 +0300 |
commit | 70b4a4f044cac8052bb0af7c585572e54489ea2f (patch) | |
tree | 5611bfb19af4d847b017df5d79f89b4bbb50e9f1 /include/py/homekit/camera/config.py | |
parent | 77b80dd9b3500539b24b7dc6258c02c23fd4d015 (diff) |
ipcam_ntp_util: support chinese noname cameras
Diffstat (limited to 'include/py/homekit/camera/config.py')
-rw-r--r-- | include/py/homekit/camera/config.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/py/homekit/camera/config.py b/include/py/homekit/camera/config.py index 0ed75cf..9685cab 100644 --- a/include/py/homekit/camera/config.py +++ b/include/py/homekit/camera/config.py @@ -132,6 +132,9 @@ class IpcamConfig(ConfigUnit): # def get_cam_server_and_disk(self, cam: int) -> tuple[str, int]: # return self['cameras'][cam]['server'], self['cameras'][cam]['disk'] + def has_camera(self, camera: int) -> bool: + return camera in tuple(self['cameras'].keys()) + def get_camera_container(self, camera: int) -> VideoContainerType: return self.get_camera_type(camera).get_container() @@ -143,3 +146,9 @@ class IpcamConfig(ConfigUnit): def get_camera_ip(self, camera: int) -> str: return self['camera_ip_template'] % (str(camera),) + + def is_camera_enabled(self, camera: int) -> bool: + try: + return self['cameras'][camera]['enabled'] + except KeyError: + return True |