Add object detection, tracking, mobile notifications, and search to any security camera.
still use qwen when no userid but own server
Rory Clear2f65c739d546
diff --git a/clearcam.py b/clearcam.pyindex 3a1474b..ef96f28 100644--- a/clearcam.py+++ b/clearcam.py@@ -1254,7 +1254,7 @@ def set_settings(x): # todo, save to db, do logic in GlobalSettings class, sanityolo_jit_cache = {}model = YOLOv9(x.model_size, x.model_res)- if x.key == None: # dont use alerts without a key+ if x.key == None and x.server_url == "https://clearcam.org": # dont use alerts without a key, unless own server!x.userID = Nonex.use_qwen = False@@ -1405,8 +1405,8 @@ class GlobalSettings:self.__dict__.update(state)if not hasattr(self, "qwen_prompt"): self.qwen_prompt = "What has been detected on my CCTV camera? Write in one short sentence"- def use_notifs(self): return self.userID- def clearcam_user(self): return self.userID is not None and self.server_url == "https://clearcam.org"+ def use_notifs(self): return self.userID or self.server_url != "https://clearcam.org"+ def clearcam_user(self): return self.userID is not Nonedef secret_settings(settings):return GlobalSettings(diff --git a/utils/helpers.py b/utils/helpers.pyindex ae9cfe6..b5ffc6c 100644--- a/utils/helpers.py+++ b/utils/helpers.py@@ -21,28 +21,30 @@ def send_notif(session_token: str, text=None, body_text=None, host="https://cleaendpoint = "/send" #/testboundary = f"Boundary-{uuid.uuid4()}"content_type = f"multipart/form-data; boundary={boundary}"- lines = [+ lines = []+ if session_token is not None:+ lines.extend([f"--{boundary}",'Content-Disposition: form-data; name="session_token"',"",session_token,- f"--{boundary}--",- ""- ]+ ])if text is not None:lines.extend([- f"--{boundary}",- 'Content-Disposition: form-data; name="text"',- "",- text,- ])+ f"--{boundary}",+ 'Content-Disposition: form-data; name="text"',+ "",+ text,+ ])if body_text is not None:lines.extend([- f"--{boundary}",- 'Content-Disposition: form-data; name="body_text"',- "",- body_text,- ])+ f"--{boundary}",+ 'Content-Disposition: form-data; name="body_text"',+ "",+ body_text,+ ])+ lines.extend([f"--{boundary}--", ""])+body = "\r\n".join(lines).encode("utf-8")if img is not None and host != "clearcam.org":with open(img, "rb") as f: img_data = f.read()