Improve API

This commit is contained in:
Nicolas Mowen 2025-05-14 08:21:06 -06:00
parent 0997b471b8
commit a35daaaf8c
2 changed files with 6 additions and 6 deletions

View File

@ -551,7 +551,7 @@ def recording_clip(
camera_name: str,
start_ts: float,
end_ts: float,
trim: bool = True,
trim: str = "start,end",
):
def run_download(ffmpeg_cmd: list[str], file_path: str):
with sp.Popen(
@ -595,13 +595,13 @@ def recording_clip(
for clip in recordings:
file.write(f"file '{clip.path}'\n")
# if this is the starting clip and trim is enabled, add an inpoint
if trim and clip.start_time < start_ts:
# if this is the starting clip and start trim is enabled, add an inpoint
if "start" in trim and clip.start_time < start_ts:
file.write(f"inpoint {int(start_ts - clip.start_time)}\n")
# if this is the ending clip, add an outpoint
# if this is the ending clip and end trim is enabled, add an outpoint
# we don't trim the output because the VOD also removes outpoint
if clip.end_time > end_ts:
if "end" in trim and clip.end_time > end_ts:
file.write(f"outpoint {int(end_ts - clip.start_time)}\n")
if len(file_name) > 1000:

View File

@ -1270,7 +1270,7 @@ export function VideoTab({ search }: VideoTabProps) {
<TooltipTrigger asChild>
<a
download
href={`${baseUrl}api/${search.camera}/start/${search.start_time}/end/${endTime}/clip.mp4?trim=False`}
href={`${baseUrl}api/${search.camera}/start/${search.start_time}/end/${endTime}/clip.mp4?trim=end`}
>
<Chip className="cursor-pointer rounded-md bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500">
<FaDownload className="size-4 text-white" />