Skip to content

Commit

Permalink
Cleanup review imports
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed Dec 9, 2024
1 parent 155d83d commit bfb7c45
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion frigate/api/defs/query/review_query_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pydantic import BaseModel
from pydantic.json_schema import SkipJsonSchema

from frigate.review.maintainer import SeverityEnum
from frigate.review.types import SeverityEnum


class ReviewQueryParams(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion frigate/api/defs/response/review_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from pydantic import BaseModel, Json

from frigate.review.maintainer import SeverityEnum
from frigate.review.types import SeverityEnum


class ReviewSegmentResponse(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion frigate/api/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
)
from frigate.api.defs.tags import Tags
from frigate.models import Recordings, ReviewSegment
from frigate.review.maintainer import SeverityEnum
from frigate.review.types import SeverityEnum
from frigate.util.builtin import get_tz_modifiers

logger = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion frigate/events/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ def expire_clips(self) -> list[str]:

def run(self) -> None:
# only expire events every 5 minutes
while not self.stop_event.wait(300):
while not self.stop_event.wait(1):
events_with_expired_clips = self.expire_clips()
return

# delete timeline entries for events that have expired recordings
# delete up to 100,000 at a time
Expand Down
7 changes: 1 addition & 6 deletions frigate/review/maintainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import string
import sys
import threading
from enum import Enum
from multiprocessing.synchronize import Event as MpEvent
from pathlib import Path
from typing import Optional
Expand All @@ -27,6 +26,7 @@
from frigate.events.external import ManualEventState
from frigate.models import ReviewSegment
from frigate.object_processing import TrackedObject
from frigate.review.types import SeverityEnum
from frigate.util.image import SharedMemoryFrameManager, calculate_16_9_crop

logger = logging.getLogger(__name__)
Expand All @@ -39,11 +39,6 @@
THRESHOLD_DETECTION_ACTIVITY = 30


class SeverityEnum(str, Enum):
alert = "alert"
detection = "detection"


class PendingReviewSegment:
def __init__(
self,
Expand Down
6 changes: 6 additions & 0 deletions frigate/review/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum


class SeverityEnum(str, Enum):
alert = "alert"
detection = "detection"
2 changes: 1 addition & 1 deletion frigate/test/http_api/base_http_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from frigate.api.fastapi_app import create_fastapi_app
from frigate.config import FrigateConfig
from frigate.models import Event, Recordings, ReviewSegment
from frigate.review.maintainer import SeverityEnum
from frigate.review.types import SeverityEnum
from frigate.test.const import TEST_DB, TEST_DB_CLEANUPS


Expand Down
2 changes: 1 addition & 1 deletion frigate/test/http_api/test_http_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from fastapi.testclient import TestClient

from frigate.models import Event, Recordings, ReviewSegment
from frigate.review.maintainer import SeverityEnum
from frigate.review.types import SeverityEnum
from frigate.test.http_api.base_http_test import BaseTestHttp


Expand Down
2 changes: 1 addition & 1 deletion frigate/track/tracked_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
CameraConfig,
ModelConfig,
)
from frigate.review.maintainer import SeverityEnum
from frigate.review.types import SeverityEnum
from frigate.util.image import (
area,
calculate_region,
Expand Down

0 comments on commit bfb7c45

Please sign in to comment.