2021-06-07 03:24:36 +02:00
|
|
|
from numpy import unique
|
2022-04-16 17:40:04 +02:00
|
|
|
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
|
|
|
|
2022-04-16 17:40:04 +02: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)
|
2022-03-17 13:18:43 +01:00
|
|
|
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()
|
2020-11-15 15:50:49 +01:00
|
|
|
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()
|
2022-02-22 05:03:01 +01:00
|
|
|
retain_indefinitely = BooleanField(default=False)
|
2022-04-10 15:25:18 +02:00
|
|
|
ratio = FloatField(default=1.0)
|
2022-04-03 22:00:11 +02:00
|
|
|
plus_id = CharField(max_length=30)
|
2021-06-07 03:24:36 +02:00
|
|
|
|
|
|
|
|
2022-04-16 17:40:04 +02:00
|
|
|
class Recordings(Model): # type: ignore[misc]
|
2021-06-07 03:24:36 +02:00
|
|
|
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()
|
2021-12-11 20:47:59 +01:00
|
|
|
motion = IntegerField(null=True)
|
|
|
|
objects = IntegerField(null=True)
|
2022-10-09 13:28:26 +02:00
|
|
|
segment_size = FloatField(default=0) # this should be stored as MB
|