blakeblackshear.frigate/frigate/models.py

44 lines
1.3 KiB
Python
Raw Normal View History

from numpy import unique
from peewee import (
Model,
CharField,
DateTimeField,
FloatField,
BooleanField,
TextField,
IntegerField,
)
2022-04-18 13:52:13 +02:00
from playhouse.sqlite_ext import JSONField
2020-11-01 15:06:15 +01:00
2020-11-04 13:31:25 +01:00
class Event(Model): # type: ignore[misc]
2020-11-01 15:06:15 +01:00
id = CharField(null=False, primary_key=True, max_length=30)
label = CharField(index=True, max_length=20)
sub_label = CharField(max_length=20, null=True)
2020-11-01 15:06:15 +01:00
camera = CharField(index=True, max_length=20)
start_time = DateTimeField()
end_time = DateTimeField()
top_score = FloatField()
false_positive = BooleanField()
2020-11-04 13:31:25 +01:00
zones = JSONField()
thumbnail = TextField()
2020-12-24 14:47:27 +01:00
has_clip = BooleanField(default=True)
has_snapshot = BooleanField(default=True)
2021-09-23 14:31:48 +02:00
region = JSONField()
box = JSONField()
2021-09-26 16:42:31 +02:00
area = IntegerField()
retain_indefinitely = BooleanField(default=False)
ratio = FloatField(default=1.0)
2022-04-03 22:00:11 +02:00
plus_id = CharField(max_length=30)
class Recordings(Model): # type: ignore[misc]
id = CharField(null=False, primary_key=True, max_length=30)
camera = CharField(index=True, max_length=20)
path = CharField(unique=True)
start_time = DateTimeField()
end_time = DateTimeField()
duration = FloatField()
motion = IntegerField(null=True)
objects = IntegerField(null=True)