Catch case where user requsts clip for time that has no recordings

This commit is contained in:
Nicolas Mowen 2025-11-17 12:39:48 -07:00
parent ab3c12b89e
commit c487d0aa93

View File

@ -762,6 +762,15 @@ async def recording_clip(
.order_by(Recordings.start_time.asc())
)
if recordings.count() == 0:
return JSONResponse(
content={
"success": False,
"message": "No recordings found for the specified time range",
},
status_code=400,
)
file_name = sanitize_filename(f"playlist_{camera_name}_{start_ts}-{end_ts}.txt")
file_path = os.path.join(CACHE_DIR, file_name)
with open(file_path, "w") as file: