From 2b685ac343be35fe71fd3908ac853177c894e288 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sun, 19 Feb 2023 06:38:16 -0700 Subject: [PATCH] Plus upload in progress (#5521) * Fix frigate+ uploading bug Fixes https://github.com/blakeblackshear/frigate/issues/5515 * wording * Formatting * Don't show button when event is in progress * Don't show in download menu either --- frigate/http.py | 21 +++++++++++++++++++++ web/src/routes/Events.jsx | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/frigate/http.py b/frigate/http.py index 4ae4d4d95..a5f9834eb 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -184,6 +184,18 @@ def send_to_plus(id): logger.error(message) return make_response(jsonify({"success": False, "message": message}), 404) + if event.end_time is None: + logger.error(f"Unable to load clean png for in-progress event: {event.id}") + return make_response( + jsonify( + { + "success": False, + "message": "Unable to load clean png for in-progress event", + } + ), + 400, + ) + if event.plus_id: message = "Already submitted to plus" logger.error(message) @@ -202,6 +214,15 @@ def send_to_plus(id): 400, ) + if image is None or image.size == 0: + logger.error(f"Unable to load clean png for event: {event.id}") + return make_response( + jsonify( + {"success": False, "message": "Unable to load clean png for event"} + ), + 400, + ) + try: plus_id = current_app.plus_api.upload_image(image, event.camera) except Exception as ex: diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index 87ae63ec8..5558c3fe6 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -366,7 +366,7 @@ export default function Events({ path, ...props }) { download /> )} - {downloadEvent.has_snapshot && !downloadEvent.plus_id && ( + {(downloadEvent.end_time && downloadEvent.has_snapshot && !downloadEvent.plus_id) && (