mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-17 16:44:29 +03:00
add enum and change topic name
This commit is contained in:
parent
5b1b6b5be0
commit
36391c844e
@ -22,7 +22,7 @@ from frigate.const import (
|
|||||||
)
|
)
|
||||||
from frigate.models import Event, Previews, Recordings, ReviewSegment
|
from frigate.models import Event, Previews, Recordings, ReviewSegment
|
||||||
from frigate.ptz.onvif import OnvifCommandEnum, OnvifController
|
from frigate.ptz.onvif import OnvifCommandEnum, OnvifController
|
||||||
from frigate.types import ModelStatusTypesEnum
|
from frigate.types import ModelStatusTypesEnum, TrackedObjectUpdateTypesEnum
|
||||||
from frigate.util.object import get_camera_regions_grid
|
from frigate.util.object import get_camera_regions_grid
|
||||||
from frigate.util.services import restart_frigate
|
from frigate.util.services import restart_frigate
|
||||||
|
|
||||||
@ -136,9 +136,24 @@ class Dispatcher:
|
|||||||
event: Event = Event.get(Event.id == payload["id"])
|
event: Event = Event.get(Event.id == payload["id"])
|
||||||
event.data["description"] = payload["description"]
|
event.data["description"] = payload["description"]
|
||||||
event.save()
|
event.save()
|
||||||
|
print(
|
||||||
|
json.dumps(
|
||||||
|
{
|
||||||
|
"type": TrackedObjectUpdateTypesEnum.description,
|
||||||
|
"id": event.id,
|
||||||
|
"description": event.data["description"],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
self.publish(
|
self.publish(
|
||||||
"event_update",
|
"tracked_object_update",
|
||||||
json.dumps({"id": event.id, "description": event.data["description"]}),
|
json.dumps(
|
||||||
|
{
|
||||||
|
"type": TrackedObjectUpdateTypesEnum.description,
|
||||||
|
"id": event.id,
|
||||||
|
"description": event.data["description"],
|
||||||
|
}
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def handle_update_model_state():
|
def handle_update_model_state():
|
||||||
|
|||||||
@ -24,6 +24,7 @@ from frigate.const import CLIPS_DIR, UPDATE_EVENT_DESCRIPTION
|
|||||||
from frigate.events.types import EventTypeEnum
|
from frigate.events.types import EventTypeEnum
|
||||||
from frigate.genai import get_genai_client
|
from frigate.genai import get_genai_client
|
||||||
from frigate.models import Event
|
from frigate.models import Event
|
||||||
|
from frigate.types import TrackedObjectUpdateTypesEnum
|
||||||
from frigate.util.builtin import serialize
|
from frigate.util.builtin import serialize
|
||||||
from frigate.util.image import SharedMemoryFrameManager, calculate_region
|
from frigate.util.image import SharedMemoryFrameManager, calculate_region
|
||||||
|
|
||||||
@ -287,7 +288,11 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
# fire and forget description update
|
# fire and forget description update
|
||||||
self.requestor.send_data(
|
self.requestor.send_data(
|
||||||
UPDATE_EVENT_DESCRIPTION,
|
UPDATE_EVENT_DESCRIPTION,
|
||||||
{"id": event.id, "description": description},
|
{
|
||||||
|
"type": TrackedObjectUpdateTypesEnum.description,
|
||||||
|
"id": event.id,
|
||||||
|
"description": description,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
# Embed the description
|
# Embed the description
|
||||||
|
|||||||
@ -19,3 +19,7 @@ class ModelStatusTypesEnum(str, Enum):
|
|||||||
downloading = "downloading"
|
downloading = "downloading"
|
||||||
downloaded = "downloaded"
|
downloaded = "downloaded"
|
||||||
error = "error"
|
error = "error"
|
||||||
|
|
||||||
|
|
||||||
|
class TrackedObjectUpdateTypesEnum(str, Enum):
|
||||||
|
description = "description"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user