mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-02-14 00:17:05 +01:00
Remove obsolete event clip logic (#16504)
* Remove obsolete event clip logic * Formatting
This commit is contained in:
parent
2458f667c4
commit
73fee6372b
@ -1088,30 +1088,8 @@ def event_clip(request: Request, event_id: str):
|
||||
content={"success": False, "message": "Clip not available"}, status_code=404
|
||||
)
|
||||
|
||||
file_name = f"{event.camera}-{event.id}.mp4"
|
||||
clip_path = os.path.join(CLIPS_DIR, file_name)
|
||||
|
||||
if not os.path.isfile(clip_path):
|
||||
end_ts = (
|
||||
datetime.now().timestamp() if event.end_time is None else event.end_time
|
||||
)
|
||||
return recording_clip(request, event.camera, event.start_time, end_ts)
|
||||
|
||||
headers = {
|
||||
"Content-Description": "File Transfer",
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Type": "video/mp4",
|
||||
"Content-Length": str(os.path.getsize(clip_path)),
|
||||
# nginx: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_headers
|
||||
"X-Accel-Redirect": f"/clips/{file_name}",
|
||||
}
|
||||
|
||||
return FileResponse(
|
||||
clip_path,
|
||||
media_type="video/mp4",
|
||||
filename=file_name,
|
||||
headers=headers,
|
||||
)
|
||||
end_ts = datetime.now().timestamp() if event.end_time is None else event.end_time
|
||||
return recording_clip(request, event.camera, event.start_time, end_ts)
|
||||
|
||||
|
||||
@router.get("/events/{event_id}/preview.gif")
|
||||
|
Loading…
Reference in New Issue
Block a user