Skip to content

Commit

Permalink
not in this pr
Browse files Browse the repository at this point in the history
  • Loading branch information
MateoLostanlen committed Apr 22, 2024
1 parent 48bb7f1 commit 489d32b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions pyroengine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,22 @@ def process_prediction(self, preds: np.ndarray, frame: Image.Image, cam_id: Opti
self._dump_cache()
self.last_cache_dump = ts

# save frame
if len(self.api_client) > 0 and isinstance(self.frame_saving_period, int) and isinstance(cam_id, str):
self._states[cam_key]["frame_count"] += 1
if self._states[cam_key]["frame_count"] == self.frame_saving_period:
# Save frame on device
self._local_backup(frame_resize, cam_id, is_alert=False)
# Send frame to the api
stream = io.BytesIO()
frame_resize.save(stream, format="JPEG", quality=self.jpeg_quality)
try:
self._upload_frame(cam_id, stream.getvalue())
# Reset frame counter
self._states[cam_key]["frame_count"] = 0
except ConnectionError:
stream.seek(0) # "Rewind" the stream to the beginning so we can read its content

return float(conf)

def _upload_frame(self, cam_id: str, media_data: bytes) -> Response:
Expand Down
2 changes: 1 addition & 1 deletion pyroengine/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

CAM_URL = "http://{ip_address}/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user={login}&password={password}"
CAM_URL = "https://{ip_address}/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user={login}&password={password}"


class ReolinkCamera:
Expand Down

0 comments on commit 489d32b

Please sign in to comment.