This commit is contained in:
Nick Mowen 2022-07-01 12:03:45 -06:00
parent 8986dc3f5b
commit 6904b3594e

View File

@ -690,32 +690,15 @@ def latest_frame(camera_name):
@bp.route("/recordings/storage") @bp.route("/recordings/storage")
def recordings_storage_usage(): def get_recordings_storage_usage():
total_bytes = 0 recording_stats = stats_snapshot(current_app.stats_tracking)["service"]["storage"][
storage = {} RECORD_DIR
for camera_name in current_app.frigate_config.cameras.keys():
camera_bytes = 0
du_cmd = [
"du",
"-h",
RECORD_DIR,
] ]
p: sp.CompletedProcess = sp.run( total_bytes = recording_stats["total"]
du_cmd, storage = {"cameras": {}, "total": total_bytes}
encoding="ascii",
capture_output=True,
)
summary = sp.check_output(('grep', camera_name), stdin=p.stdout)
for line in summary.split("\n"):
logger.error(F"Found the line {line}")
camera_bytes += 1
storage[camera_name] = camera_bytes storage[camera_name] = camera_bytes
total_bytes += camera_bytes total_bytes += camera_bytes
storage["total"] = total_bytes
return jsonify(storage) return jsonify(storage)