mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-23 19:11:14 +01:00
b4d4adb75b
* Add field and migration for segment size * Store the segment size in db * Add comment * Add default * Fix size parsing * Include segment size in recordings endpoint * Start adding storage maintainer * Add storage maintainer and calculate average sizes * Update comment * Store segment and hour avg sizes per camera * Formatting * Keep track of total segment and hour averages * Remove unused files * Cleanup 2 hours of recordings at a time * Formatting * Fix bug * Round segment size * Cleanup some comments * Handle case where segments are not deleted on initial run or is only retained segments * Improve cleanup log * Formatting * Fix typo and improve logging * Catch case where no recordings exist for camera * Specifically define sort * Handle edge case for cameras that only record part time * Increase definition of part time recorder * Remove warning about not supported storage based retention * Add note about storage based retention to recording docs * Add tests for storage maintenance calculation and cleanup * Format tests * Don't run for a camera with no recording segments * Get size of file from cache * Rework camera stats to be more efficient * Remove total and other inefficencies * Rewrite storage cleanup logic to be much more efficient * Fix existing tests * Fix bugs from tests * Add another test * Improve logging * Formatting * Set back correct loop time * Update name * Update comment * Only include segments that have a nonzero size * Catch case where camera has 0 nonzero segment durations * Add test to cover zero bandwidth migration case * Fix test * Incorrect boolean logic * Formatting * Explicity re-define iterator
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
from numpy import unique
|
|
from peewee import (
|
|
Model,
|
|
CharField,
|
|
DateTimeField,
|
|
FloatField,
|
|
BooleanField,
|
|
TextField,
|
|
IntegerField,
|
|
)
|
|
from playhouse.sqlite_ext import JSONField
|
|
|
|
|
|
class Event(Model): # type: ignore[misc]
|
|
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)
|
|
camera = CharField(index=True, max_length=20)
|
|
start_time = DateTimeField()
|
|
end_time = DateTimeField()
|
|
top_score = FloatField()
|
|
false_positive = BooleanField()
|
|
zones = JSONField()
|
|
thumbnail = TextField()
|
|
has_clip = BooleanField(default=True)
|
|
has_snapshot = BooleanField(default=True)
|
|
region = JSONField()
|
|
box = JSONField()
|
|
area = IntegerField()
|
|
retain_indefinitely = BooleanField(default=False)
|
|
ratio = FloatField(default=1.0)
|
|
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)
|
|
segment_size = FloatField(default=0) # this should be stored as MB
|