From afc7b44700437343e82bf0061b06d91025999075 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Sun, 9 Oct 2022 09:54:47 -0600 Subject: [PATCH] Remove total from equation --- frigate/http.py | 4 ---- frigate/storage.py | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/frigate/http.py b/frigate/http.py index 3c9f487a3..1101b69b6 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -694,7 +694,6 @@ def latest_frame(camera_name): @bp.route("/recordings/storage") def get_recordings_storage_usage(): - include_total = request.args.get("include_total", True) recording_stats = stats_snapshot(current_app.stats_tracking)["service"]["storage"][ RECORD_DIR ] @@ -704,9 +703,6 @@ def get_recordings_storage_usage(): str, dict ] = current_app.storage_maintainer.calculate_camera_usages() - if not include_total: - del camera_usages["total"] - for camera_name in camera_usages.keys(): camera_usages[camera_name]["usage_percent"] = ( camera_usages[camera_name]["usage"] / total_mb diff --git a/frigate/storage.py b/frigate/storage.py index dd6218e76..8700f3714 100644 --- a/frigate/storage.py +++ b/frigate/storage.py @@ -63,7 +63,6 @@ class StorageMaintainer(threading.Thread): def calculate_camera_usages(self) -> dict[str, dict]: """Calculate the storage usage of each camera.""" usages: dict[str, dict] = {} - total_storage = 0 for camera in self.config.cameras.keys(): camera_storage = ( @@ -71,10 +70,9 @@ class StorageMaintainer(threading.Thread): .where(Recordings.camera == camera, Recordings.segment_size != 0) .scalar() ) - total_storage += camera_storage + usages[camera] = {"usage": camera_storage} - usages["total"] = {"usage": total_storage} return usages def check_storage_needs_cleanup(self) -> bool: