Skip to content

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

Duration (#118)

Rory Clear268f18ab0da1
diff --git a/clearcam.py b/clearcam.py
index 12e0564..d164530 100644
--- a/clearcam.py
+++ b/clearcam.py
@@ -276,7 +276,7 @@ class VideoCapture:
"-c", "copy",
"-f", "hls",
"-hls_list_size", "0",
- "-hls_flags", "+append_list",
+ "-hls_flags", "append_list+temp_file",
"-hls_playlist_type", "event",
"-an", # No audio
"-hls_segment_filename", str(path/ "stream_%06d.ts"),
@@ -1222,7 +1222,7 @@ def schedule_daily_restart(hls_streamer, videocapture, restart_time):
os.execv(python, [python] + sys.argv)
def send_notif(session_token: str, text=None):
- host = "www.rors.ai"
+ host = "www.clearcam.org"
endpoint = "/send" #/test
boundary = f"Boundary-{uuid.uuid4()}"
content_type = f"multipart/form-data; boundary={boundary}"
@@ -1323,7 +1323,7 @@ def upload_file(file_path: Path, session_token: str):
"size": str(file_size)
}
query_string = urllib.parse.urlencode(params)
- url = f"https://rors.ai/upload?{query_string}"
+ url = f"https://clearcam.org/upload?{query_string}"
req = urllib.request.Request(url)
with urllib.request.urlopen(req, timeout=10) as response:
@@ -1417,7 +1417,7 @@ def check_upload_link(cam_name="clearcampy"):
"name": quote(cam_name),
"session_token": userID
})
- url = f"https://rors.ai/get_stream_upload_link?{query_params}"
+ url = f"https://clearcam.org/get_stream_upload_link?{query_params}"
req = urllib.request.Request(url)
with urllib.request.urlopen(req) as response:
diff --git a/mainview.html b/mainview.html
index 43c78eb..90afd06 100644
--- a/mainview.html
+++ b/mainview.html
@@ -2663,7 +2663,11 @@
const res = await fetch(url, { cache: "no-store" });
if (res.ok) {
const text = await res.text();
- if (text.includes("#EXTINF")) return true;
+ const segmentCount = (text.match(/#EXTINF/g) || []).length;
+ if (segmentCount >= 1) {
+ console.log(`Manifest ready with ${segmentCount} segments`);
+ return true;
+ }
}
} catch (err) {
// ignore / retry