Pass in event processor

This commit is contained in:
Nick Mowen 2023-05-01 08:23:47 -06:00
parent 4d35b92e8a
commit 73a1b970f6
2 changed files with 8 additions and 1 deletions

View File

@ -29,6 +29,7 @@ from frigate.const import (
) )
from frigate.object_detection import ObjectDetectProcess from frigate.object_detection import ObjectDetectProcess
from frigate.events.cleanup import EventCleanup from frigate.events.cleanup import EventCleanup
from frigate.events.external import ExternalEventProcessor
from frigate.events.maintainer import EventProcessor from frigate.events.maintainer import EventProcessor
from frigate.http import create_app from frigate.http import create_app
from frigate.log import log_process, root_configurer from frigate.log import log_process, root_configurer
@ -205,6 +206,9 @@ class FrigateApp:
self.config, self.camera_metrics, self.detectors, self.processes self.config, self.camera_metrics, self.detectors, self.processes
) )
def init_external_event_processor(self) -> None:
self.event_processor = ExternalEventProcessor(self.config, self.event_queue)
def init_web_server(self) -> None: def init_web_server(self) -> None:
self.flask_app = create_app( self.flask_app = create_app(
self.config, self.config,
@ -213,6 +217,7 @@ class FrigateApp:
self.detected_frames_processor, self.detected_frames_processor,
self.storage_maintainer, self.storage_maintainer,
self.onvif_controller, self.onvif_controller,
self.event_processor,
self.plus_api, self.plus_api,
) )
@ -437,6 +442,7 @@ class FrigateApp:
self.start_camera_capture_processes() self.start_camera_capture_processes()
self.start_storage_maintainer() self.start_storage_maintainer()
self.init_stats() self.init_stats()
self.init_external_event_processor()
self.init_web_server() self.init_web_server()
self.start_timeline_processor() self.start_timeline_processor()
self.start_event_processor() self.start_event_processor()

View File

@ -34,7 +34,7 @@ from playhouse.shortcuts import model_to_dict
from frigate.config import FrigateConfig from frigate.config import FrigateConfig
from frigate.const import CLIPS_DIR, MAX_SEGMENT_DURATION, RECORD_DIR from frigate.const import CLIPS_DIR, MAX_SEGMENT_DURATION, RECORD_DIR
from frigate.models import Event, Recordings, Timeline from frigate.models import Event, Recordings, Timeline
from frigate.events_manual import create_manual_event, finish_manual_event from frigate.events.external import ExternalEventProcessor
from frigate.object_processing import TrackedObject from frigate.object_processing import TrackedObject
from frigate.plus import PlusApi from frigate.plus import PlusApi
from frigate.ptz import OnvifController from frigate.ptz import OnvifController
@ -62,6 +62,7 @@ def create_app(
detected_frames_processor, detected_frames_processor,
storage_maintainer: StorageMaintainer, storage_maintainer: StorageMaintainer,
onvif: OnvifController, onvif: OnvifController,
external_processor: ExternalEventProcessor,
plus_api: PlusApi, plus_api: PlusApi,
): ):
app = Flask(__name__) app = Flask(__name__)