mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-04 18:25:22 +03:00
Add other fields
This commit is contained in:
parent
616566a8f9
commit
cd19b611f0
@ -23,7 +23,7 @@ from frigate.object_detection import ObjectDetectProcess
|
|||||||
from frigate.events import EventCleanup, EventProcessor
|
from frigate.events import EventCleanup, EventProcessor
|
||||||
from frigate.http import create_app
|
from frigate.http import create_app
|
||||||
from frigate.log import log_process, root_configurer
|
from frigate.log import log_process, root_configurer
|
||||||
from frigate.models import Event, Recordings
|
from frigate.models import Event, Recordings, Timeline
|
||||||
from frigate.object_processing import TrackedObjectProcessor
|
from frigate.object_processing import TrackedObjectProcessor
|
||||||
from frigate.output import output_frames
|
from frigate.output import output_frames
|
||||||
from frigate.plus import PlusApi
|
from frigate.plus import PlusApi
|
||||||
@ -154,7 +154,7 @@ class FrigateApp:
|
|||||||
migrate_db.close()
|
migrate_db.close()
|
||||||
|
|
||||||
self.db = SqliteQueueDatabase(self.config.database.path)
|
self.db = SqliteQueueDatabase(self.config.database.path)
|
||||||
models = [Event, Recordings]
|
models = [Event, Recordings, Timeline]
|
||||||
self.db.bind(models)
|
self.db.bind(models)
|
||||||
|
|
||||||
def init_stats(self) -> None:
|
def init_stats(self) -> None:
|
||||||
|
|||||||
@ -38,7 +38,11 @@ class Timeline(Model): # type: ignore[misc]
|
|||||||
input_type = CharField(index=True, max_length=20) # ex: object, audio, external
|
input_type = CharField(index=True, max_length=20) # ex: object, audio, external
|
||||||
detection_type = CharField(max_length=50) # ex: entered_front_yard, heard_dog_barking
|
detection_type = CharField(max_length=50) # ex: entered_front_yard, heard_dog_barking
|
||||||
timestamp = DateTimeField()
|
timestamp = DateTimeField()
|
||||||
|
|
||||||
|
# event-only fields
|
||||||
event_id = CharField()
|
event_id = CharField()
|
||||||
|
region = JSONField()
|
||||||
|
box = JSONField()
|
||||||
|
|
||||||
|
|
||||||
class Recordings(Model): # type: ignore[misc]
|
class Recordings(Model): # type: ignore[misc]
|
||||||
|
|||||||
@ -37,7 +37,7 @@ SQL = pw.SQL
|
|||||||
|
|
||||||
def migrate(migrator, database, fake=False, **kwargs):
|
def migrate(migrator, database, fake=False, **kwargs):
|
||||||
migrator.sql(
|
migrator.sql(
|
||||||
'CREATE TABLE IF NOT EXISTS "timeline" ("id" VARCHAR(30) NOT NULL PRIMARY KEY, "camera" VARCHAR(20) NOT NULL, "input_type" VARCHAR(20) NOT NULL, "detection_type" VARCHAR(50) NOT NULL, "timestamp" DATETIME NOT NULL, "event_id" VARCHAR(30))'
|
'CREATE TABLE IF NOT EXISTS "timeline" ("id" VARCHAR(30) NOT NULL PRIMARY KEY, "camera" VARCHAR(20) NOT NULL, "input_type" VARCHAR(20) NOT NULL, "detection_type" VARCHAR(50) NOT NULL, "timestamp" DATETIME NOT NULL, "event_id" VARCHAR(30), "region" JSON, "box" JSON)'
|
||||||
)
|
)
|
||||||
migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_camera" ON "timeline" ("camera")')
|
migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_camera" ON "timeline" ("camera")')
|
||||||
migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_input_type" ON "timeline" ("input_type")')
|
migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_input_type" ON "timeline" ("input_type")')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user