mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-07-26 13:47:03 +02:00
Mqtt sub labels (#3899)
* Set sub label on object data if event is in progress * Include sub_label in dict * Don't need to set and passively get * Formatting * Don't expect event to be valid * Update docs to reflect that sub label is included
This commit is contained in:
parent
53f7190d42
commit
a1ae5b67d8
@ -45,6 +45,7 @@ Message published for each changed event. The first message is published when th
|
|||||||
"frame_time": 1607123961.837752,
|
"frame_time": 1607123961.837752,
|
||||||
"snapshot_time": 1607123961.837752,
|
"snapshot_time": 1607123961.837752,
|
||||||
"label": "person",
|
"label": "person",
|
||||||
|
"sub_label": null,
|
||||||
"top_score": 0.958984375,
|
"top_score": 0.958984375,
|
||||||
"false_positive": false,
|
"false_positive": false,
|
||||||
"start_time": 1607123955.475377,
|
"start_time": 1607123955.475377,
|
||||||
@ -69,6 +70,7 @@ Message published for each changed event. The first message is published when th
|
|||||||
"frame_time": 1607123962.082975,
|
"frame_time": 1607123962.082975,
|
||||||
"snapshot_time": 1607123961.837752,
|
"snapshot_time": 1607123961.837752,
|
||||||
"label": "person",
|
"label": "person",
|
||||||
|
"sub_label": null,
|
||||||
"top_score": 0.958984375,
|
"top_score": 0.958984375,
|
||||||
"false_positive": false,
|
"false_positive": false,
|
||||||
"start_time": 1607123955.475377,
|
"start_time": 1607123955.475377,
|
||||||
|
@ -28,6 +28,7 @@ from playhouse.shortcuts import model_to_dict
|
|||||||
|
|
||||||
from frigate.const import CLIPS_DIR
|
from frigate.const import CLIPS_DIR
|
||||||
from frigate.models import Event, Recordings
|
from frigate.models import Event, Recordings
|
||||||
|
from frigate.object_processing import TrackedObject, TrackedObjectProcessor
|
||||||
from frigate.stats import stats_snapshot
|
from frigate.stats import stats_snapshot
|
||||||
from frigate.version import VERSION
|
from frigate.version import VERSION
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ def delete_retain(id):
|
|||||||
@bp.route("/events/<id>/sub_label", methods=("POST",))
|
@bp.route("/events/<id>/sub_label", methods=("POST",))
|
||||||
def set_sub_label(id):
|
def set_sub_label(id):
|
||||||
try:
|
try:
|
||||||
event = Event.get(Event.id == id)
|
event: Event = Event.get(Event.id == id)
|
||||||
except DoesNotExist:
|
except DoesNotExist:
|
||||||
return make_response(
|
return make_response(
|
||||||
jsonify({"success": False, "message": "Event " + id + " not found"}), 404
|
jsonify({"success": False, "message": "Event " + id + " not found"}), 404
|
||||||
@ -234,6 +235,16 @@ def set_sub_label(id):
|
|||||||
400,
|
400,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not event.end_time:
|
||||||
|
tracked_obj: TrackedObject = (
|
||||||
|
current_app.detected_frames_processor.camera_states[event.camera].get(
|
||||||
|
event.id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if tracked_obj:
|
||||||
|
tracked_obj.obj_data["sub_label"] = new_sub_label
|
||||||
|
|
||||||
event.sub_label = new_sub_label
|
event.sub_label = new_sub_label
|
||||||
event.save()
|
event.save()
|
||||||
return make_response(
|
return make_response(
|
||||||
|
@ -180,6 +180,7 @@ class TrackedObject:
|
|||||||
"frame_time": self.obj_data["frame_time"],
|
"frame_time": self.obj_data["frame_time"],
|
||||||
"snapshot_time": snapshot_time,
|
"snapshot_time": snapshot_time,
|
||||||
"label": self.obj_data["label"],
|
"label": self.obj_data["label"],
|
||||||
|
"sub_label": self.obj_data.get("sub_label"),
|
||||||
"top_score": self.top_score,
|
"top_score": self.top_score,
|
||||||
"false_positive": self.false_positive,
|
"false_positive": self.false_positive,
|
||||||
"start_time": self.obj_data["start_time"],
|
"start_time": self.obj_data["start_time"],
|
||||||
|
Loading…
Reference in New Issue
Block a user