mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-02-18 00:16:41 +01:00
Remove obsolete event clip logic (#16504)
* Remove obsolete event clip logic * Formatting
This commit is contained in:
parent
2458f667c4
commit
73fee6372b
@ -1088,31 +1088,9 @@ def event_clip(request: Request, event_id: str):
|
|||||||
content={"success": False, "message": "Clip not available"}, status_code=404
|
content={"success": False, "message": "Clip not available"}, status_code=404
|
||||||
)
|
)
|
||||||
|
|
||||||
file_name = f"{event.camera}-{event.id}.mp4"
|
end_ts = datetime.now().timestamp() if event.end_time is None else event.end_time
|
||||||
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)
|
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,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/events/{event_id}/preview.gif")
|
@router.get("/events/{event_id}/preview.gif")
|
||||||
def event_preview(request: Request, event_id: str):
|
def event_preview(request: Request, event_id: str):
|
||||||
|
Loading…
Reference in New Issue
Block a user