Skip to content

Commit

Permalink
reverts
Browse files Browse the repository at this point in the history
* revert auth url as it breaks camera streams when expired
* revert monitor status as it causes sensor issues
* catch another fault

Signed-off-by: Nic Boet <[email protected]>
  • Loading branch information
nabbi committed Nov 16, 2024
1 parent 7702303 commit 454056c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "zm-py"
version = "0.5.5.dev2"
version = "0.5.5.dev3"
description = "A loose python wrapper around the ZoneMinder REST API."
authors = ["Rohan Kapoor <[email protected]>"]
maintainers = ["Nic Boet <[email protected]>"]
Expand Down
5 changes: 2 additions & 3 deletions zoneminder/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def function(self) -> MonitorState:
"""Get the MonitorState of this Monitor."""
if self.update_monitor():
return MonitorState(self._raw_result["Monitor"]["Function"])
return "None"
return "Error-MonitorState"

@function.setter
def function(self, new_function):
Expand Down Expand Up @@ -187,9 +187,8 @@ def is_available(self) -> bool:
# Monitor_Status was only added in ZM 1.32.3
monitor_status = self._raw_result.get("Monitor_Status", None)
capture_fps = monitor_status and monitor_status["CaptureFPS"]
monitor_state = monitor_status and monitor_status["Status"]

return monitor_state == "Connected" and capture_fps != "0.00"
return status_response.get("status", False) and capture_fps != "0.00"

def get_events(self, time_period, include_archived=False) -> Optional[int]:
"""Get the number of events that have occurred on this Monitor.
Expand Down
16 changes: 6 additions & 10 deletions zoneminder/zm.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,14 @@ def get_zms_url(self) -> str:

def get_url_with_auth(self, url) -> str:
"""Add the auth credentials to a url (if needed)."""
if not self._username and not self._auth_token:
if not self._username:
return url

if self._auth_token:
url += f"&token={quote(self._auth_token)}"
else:
url += f"&user={quote(self._username)}"
if not self._password:
return url
url += f"&pass={quote(self._password)}"

return url
url += f"&user={quote(self._username)}"

if not self._password:
return url
return url + f"&pass={quote(self._password)}"

@property
def is_available(self) -> bool:
Expand Down

0 comments on commit 454056c

Please sign in to comment.