From 103073b587a1809ef32a45296951e012ef3fa1e3 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Thu, 5 May 2022 21:21:08 -0600 Subject: [PATCH] Add endpoint to get list of sub labels inside DB --- frigate/http.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/frigate/http.py b/frigate/http.py index 7261b4771..9183e7489 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -11,6 +11,7 @@ import subprocess as sp import time from functools import reduce from pathlib import Path +from certifi import where import cv2 from flask.helpers import send_file @@ -586,6 +587,20 @@ def mjpeg_feed(camera_name): return "Camera named {} not found".format(camera_name), 404 +@bp.route("/sub_labels") +def get_sub_labels(): + try: + sub_labels = Event.select( + Event.sub_label, + ).where(Event.sub_label != None) + except: + return jsonify( + {"success": False, "message": "Failed to get sub_labels"}, "404" + ) + + return jsonify(sub_labels) + + @bp.route("//latest.jpg") def latest_frame(camera_name): draw_options = {