Skip to content

Commit

Permalink
fix: revert global flags check (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Jun 9, 2024
1 parent c4966ee commit 8dc437f
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions src/uiprotect/data/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,11 +1203,6 @@ def is_recording_enabled(self) -> bool:

return self.recording_settings.mode is not RecordingMode.NEVER

@property
def can_manage_recording_setting(self) -> bool:
"""Can this camera manage its own recording settings?"""
return not self.use_global

@property
def is_smart_detections_allowed(self) -> bool:
"""Is smart detections allowed for this camera?"""
Expand All @@ -1216,11 +1211,6 @@ def is_smart_detections_allowed(self) -> bool:
and self.api.bootstrap.nvr.is_smart_detections_enabled
)

@property
def can_manage_smart_detections(self) -> bool:
"""Can this camera manage its own recording settings?"""
return (not self.use_global) and self.is_smart_detections_allowed

@property
def is_license_plate_detections_allowed(self) -> bool:
"""Is license plate detections allowed for this camera?"""
Expand All @@ -1229,11 +1219,6 @@ def is_license_plate_detections_allowed(self) -> bool:
and self.api.bootstrap.nvr.is_license_plate_detections_enabled
)

@property
def can_manage_license_plate_detections(self) -> bool:
"""Can this camera manage its own license plate settings?"""
return (not self.use_global) and self.is_license_plate_detections_allowed

@property
def is_face_detections_allowed(self) -> bool:
"""Is face detections allowed for this camera?"""
Expand All @@ -1242,11 +1227,6 @@ def is_face_detections_allowed(self) -> bool:
and self.api.bootstrap.nvr.is_face_detections_enabled
)

@property
def can_manage_face_detections(self) -> bool:
"""Can this camera manage its own face detection settings?"""
return (not self.use_global) and self.is_face_detections_allowed

@property
def active_recording_settings(self) -> RecordingSettings:
"""Get active recording settings."""
Expand Down Expand Up @@ -1289,7 +1269,6 @@ def is_motion_detection_on(self) -> bool:
return (
self.is_recording_enabled
and self.active_recording_settings.enable_motion_detection is not False
and self.can_manage_recording_setting
)

@property
Expand Down Expand Up @@ -1324,9 +1303,7 @@ def callback() -> None:

def _is_smart_enabled(self, smart_type: SmartDetectObjectType) -> bool:
return (
self.is_recording_enabled
and smart_type in self.active_smart_detect_types
and self.can_manage_smart_detections
self.is_recording_enabled and smart_type in self.active_smart_detect_types
)

def _is_smart_detected(self, smart_type: SmartDetectObjectType) -> bool:
Expand Down Expand Up @@ -1441,10 +1418,7 @@ def is_license_plate_detection_on(self) -> bool:
Is License Plate Detection available and enabled (camera will produce face license
plate detection events)?
"""
return (
self._is_smart_enabled(SmartDetectObjectType.LICENSE_PLATE)
and self.is_license_plate_detections_allowed
)
return self._is_smart_enabled(SmartDetectObjectType.LICENSE_PLATE)

@property
def last_license_plate_detect_event(self) -> Event | None:
Expand Down Expand Up @@ -1554,7 +1528,6 @@ def _is_audio_enabled(self, smart_type: SmartDetectObjectType) -> bool:
audio_type is not None
and self.is_recording_enabled
and audio_type in self.active_audio_detect_types
and self.can_manage_smart_detections
)

def _is_audio_detected(self, smart_type: SmartDetectObjectType) -> bool:
Expand Down

0 comments on commit 8dc437f

Please sign in to comment.