Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

clean

roryclear95f46e6a888c
diff --git a/clearcam.py b/clearcam.py
index be292ef..cb9d404 100644
--- a/clearcam.py
+++ b/clearcam.py
@@ -839,16 +839,20 @@ class HLSRequestHandler(BaseHTTPRequestHandler):
mask_file.parent.mkdir(parents=True, exist_ok=True)
with open(mask_file, "rb") as f:
mask = pickle.load(f)
+ if mask is None: mask = {}
outside = query.get("outside", [None])[0]
is_on = query.get("is_on", [None])[0]
- is_on = str(is_on).lower() == "true"
- outside = str(outside).lower() == "true"
+ if is_on is not None: is_on = str(is_on).lower() == "true"
+ if outside is not None: outside = str(outside).lower() == "true"
tl_x = query.get("tl_x", [None])[0]
tl_y = query.get("tl_y", [None])[0]
w = query.get("w", [None])[0]
h = query.get("h", [None])[0]
- mask = {"dims":[float(tl_x),float(tl_y),float(w),float(h)],"on":is_on,"outside":outside}
+
+ if tl_x is not None: mask["dims"] = [float(tl_x),float(tl_y),float(w),float(h)]
+ if is_on is not None: mask["is_on"] = is_on
+ if outside is not None: mask["outside"] = outside
with open(mask_file, 'wb') as f: pickle.dump(mask, f)
with open(edited_mask_file, 'wb') as f: pickle.dump(mask, f)
@@ -1581,10 +1585,7 @@ class HLSRequestHandler(BaseHTTPRequestHandler):
</div>
<div id="maskControls" style="margin-top: 20px; display: flex; align-items: center; gap: 12px;">
- <label>
- <input type="checkbox" id="maskCheckbox"> Enable Mask
- </label>
- <button onclick="openMaskEditor()">Edit</button>
+ <button onclick="openMaskEditor()">Mask Settings</button>
</div>
<!-- The Modal -->