mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-14 15:15:22 +03:00
Simplify logic
This commit is contained in:
parent
e75fa764d2
commit
4613bde379
@ -5,11 +5,9 @@ import itertools
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
from functools import reduce
|
|
||||||
from multiprocessing.synchronize import Event as MpEvent
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from peewee import operator
|
|
||||||
from playhouse.sqlite_ext import SqliteExtDatabase
|
from playhouse.sqlite_ext import SqliteExtDatabase
|
||||||
|
|
||||||
from frigate.config import CameraConfig, FrigateConfig, RetainModeEnum
|
from frigate.config import CameraConfig, FrigateConfig, RetainModeEnum
|
||||||
@ -75,24 +73,15 @@ class RecordingCleanup(threading.Thread):
|
|||||||
ReviewSegment.select(ReviewSegment.id)
|
ReviewSegment.select(ReviewSegment.id)
|
||||||
.where(ReviewSegment.camera == config.name)
|
.where(ReviewSegment.camera == config.name)
|
||||||
.where(
|
.where(
|
||||||
reduce(
|
(
|
||||||
operator.or_,
|
ReviewSegment.severity
|
||||||
[
|
== "alert" & ReviewSegment.end_time
|
||||||
reduce(
|
< alert_expire_date
|
||||||
operator.and_,
|
)
|
||||||
[
|
| (
|
||||||
(ReviewSegment.severity == "alert"),
|
ReviewSegment.severity
|
||||||
(ReviewSegment.end_time < alert_expire_date),
|
== "detection" & ReviewSegment.end_time
|
||||||
],
|
< detection_expire_date
|
||||||
),
|
|
||||||
reduce(
|
|
||||||
operator.and_,
|
|
||||||
[
|
|
||||||
(ReviewSegment.severity == "detection"),
|
|
||||||
(ReviewSegment.end_time < detection_expire_date),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.namedtuples()
|
.namedtuples()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user