From 78a0b5e6c9cc97e1adb6ed7350367f5ef0adadd9 Mon Sep 17 00:00:00 2001 From: Jason Hunter Date: Sun, 6 Jun 2021 21:35:27 -0400 Subject: [PATCH] clean up VOD endpoint --- frigate/http.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/frigate/http.py b/frigate/http.py index 883c5bba8..de7124698 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -564,19 +564,12 @@ def recordings(camera_name): ) -@bp.route("/vod/") -def vod(path): - # Make sure we actually have recordings - if not os.path.isdir(f"{RECORD_DIR}/{path}"): - return "Recordings not found.", 404 - - # Break up path - parts = path.split("/") - start_date = datetime.strptime(f"{parts[0]}-{parts[1]} {parts[2]}", "%Y-%m-%d %H") +@bp.route("/vod////") +def vod(year_month, day, hour, camera): + start_date = datetime.strptime(f"{year_month}-{day} {hour}", "%Y-%m-%d %H") end_date = start_date + timedelta(hours=1) start_ts = start_date.timestamp() end_ts = end_date.timestamp() - camera = parts[3] # Select all recordings where either the start or end dates fall in the requested hour recordings = (