Formatting

This commit is contained in:
Nicolas Mowen 2024-02-28 08:46:59 -07:00
parent b317b72524
commit 94300e86fd

View File

@ -917,9 +917,9 @@ def event_snapshot(id):
else: else:
response.headers["Cache-Control"] = "no-store" response.headers["Cache-Control"] = "no-store"
if download: if download:
response.headers["Content-Disposition"] = ( response.headers[
f"attachment; filename=snapshot-{id}.jpg" "Content-Disposition"
) ] = f"attachment; filename=snapshot-{id}.jpg"
return response return response
@ -1106,9 +1106,9 @@ def event_clip(id):
if download: if download:
response.headers["Content-Disposition"] = "attachment; filename=%s" % file_name response.headers["Content-Disposition"] = "attachment; filename=%s" % file_name
response.headers["Content-Length"] = os.path.getsize(clip_path) response.headers["Content-Length"] = os.path.getsize(clip_path)
response.headers["X-Accel-Redirect"] = ( response.headers[
f"/clips/{file_name}" # nginx: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_headers "X-Accel-Redirect"
) ] = f"/clips/{file_name}" # nginx: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_headers
return response return response
@ -1811,9 +1811,9 @@ def get_recordings_storage_usage():
total_mb = recording_stats["total"] total_mb = recording_stats["total"]
camera_usages: dict[str, dict] = ( camera_usages: dict[
current_app.storage_maintainer.calculate_camera_usages() str, dict
) ] = current_app.storage_maintainer.calculate_camera_usages()
for camera_name in camera_usages.keys(): for camera_name in camera_usages.keys():
if camera_usages.get(camera_name, {}).get("usage"): if camera_usages.get(camera_name, {}).get("usage"):
@ -2001,9 +2001,9 @@ def recording_clip(camera_name, start_ts, end_ts):
if download: if download:
response.headers["Content-Disposition"] = "attachment; filename=%s" % file_name response.headers["Content-Disposition"] = "attachment; filename=%s" % file_name
response.headers["Content-Length"] = os.path.getsize(path) response.headers["Content-Length"] = os.path.getsize(path)
response.headers["X-Accel-Redirect"] = ( response.headers[
f"/cache/{file_name}" # nginx: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_headers "X-Accel-Redirect"
) ] = f"/cache/{file_name}" # nginx: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_headers
return response return response