mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-09 04:35:25 +03:00
Cleanup port defining
This commit is contained in:
parent
c1bd6bdc51
commit
5f7ca2b124
@ -56,7 +56,8 @@ class InterProcessCommunicator(Communicator):
|
|||||||
class InterProcessRequestor:
|
class InterProcessRequestor:
|
||||||
"""Simplifies sending data to InterProcessCommunicator and getting a reply."""
|
"""Simplifies sending data to InterProcessCommunicator and getting a reply."""
|
||||||
|
|
||||||
def __init__(self, port: int) -> None:
|
def __init__(self) -> None:
|
||||||
|
port = os.environ.get("INTER_PROCESS_COMM_PORT") or PORT_INTER_PROCESS_COMM
|
||||||
self.context = zmq.Context()
|
self.context = zmq.Context()
|
||||||
self.socket = self.context.socket(zmq.REQ)
|
self.socket = self.context.socket(zmq.REQ)
|
||||||
self.socket.connect(f"tcp://127.0.0.1:{port}")
|
self.socket.connect(f"tcp://127.0.0.1:{port}")
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
import os
|
|
||||||
import signal
|
import signal
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
@ -23,7 +22,6 @@ from frigate.const import (
|
|||||||
AUDIO_MIN_CONFIDENCE,
|
AUDIO_MIN_CONFIDENCE,
|
||||||
AUDIO_SAMPLE_RATE,
|
AUDIO_SAMPLE_RATE,
|
||||||
FRIGATE_LOCALHOST,
|
FRIGATE_LOCALHOST,
|
||||||
PORT_INTER_PROCESS_COMM,
|
|
||||||
)
|
)
|
||||||
from frigate.ffmpeg_presets import parse_preset_input
|
from frigate.ffmpeg_presets import parse_preset_input
|
||||||
from frigate.log import LogPipe
|
from frigate.log import LogPipe
|
||||||
@ -191,11 +189,8 @@ class AudioEventMaintainer(threading.Thread):
|
|||||||
self.logpipe = LogPipe(f"ffmpeg.{self.config.name}.audio")
|
self.logpipe = LogPipe(f"ffmpeg.{self.config.name}.audio")
|
||||||
self.audio_listener = None
|
self.audio_listener = None
|
||||||
|
|
||||||
# create communication for finished previews
|
# create communication for audio detections
|
||||||
INTER_PROCESS_COMM_PORT = (
|
self.requestor = InterProcessRequestor()
|
||||||
os.environ.get("INTER_PROCESS_COMM_PORT") or PORT_INTER_PROCESS_COMM
|
|
||||||
)
|
|
||||||
self.requestor = InterProcessRequestor(INTER_PROCESS_COMM_PORT)
|
|
||||||
|
|
||||||
def detect_audio(self, audio) -> None:
|
def detect_audio(self, audio) -> None:
|
||||||
if not self.feature_metrics[self.config.name]["audio_enabled"].value:
|
if not self.feature_metrics[self.config.name]["audio_enabled"].value:
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import numpy as np
|
|||||||
|
|
||||||
from frigate.comms.inter_process import InterProcessRequestor
|
from frigate.comms.inter_process import InterProcessRequestor
|
||||||
from frigate.config import CameraConfig, RecordQualityEnum
|
from frigate.config import CameraConfig, RecordQualityEnum
|
||||||
from frigate.const import CACHE_DIR, CLIPS_DIR, INSERT_PREVIEW, PORT_INTER_PROCESS_COMM
|
from frigate.const import CACHE_DIR, CLIPS_DIR, INSERT_PREVIEW
|
||||||
from frigate.ffmpeg_presets import (
|
from frigate.ffmpeg_presets import (
|
||||||
FPS_VFR_PARAM,
|
FPS_VFR_PARAM,
|
||||||
EncodeTypeEnum,
|
EncodeTypeEnum,
|
||||||
@ -137,10 +137,7 @@ class PreviewRecorder:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# create communication for finished previews
|
# create communication for finished previews
|
||||||
INTER_PROCESS_COMM_PORT = (
|
self.requestor = InterProcessRequestor()
|
||||||
os.environ.get("INTER_PROCESS_COMM_PORT") or PORT_INTER_PROCESS_COMM
|
|
||||||
)
|
|
||||||
self.requestor = InterProcessRequestor(INTER_PROCESS_COMM_PORT)
|
|
||||||
|
|
||||||
y, u1, u2, v1, v2 = get_yuv_crop(
|
y, u1, u2, v1, v2 = get_yuv_crop(
|
||||||
self.config.frame_shape_yuv,
|
self.config.frame_shape_yuv,
|
||||||
|
|||||||
@ -25,7 +25,6 @@ from frigate.const import (
|
|||||||
INSERT_MANY_RECORDINGS,
|
INSERT_MANY_RECORDINGS,
|
||||||
MAX_SEGMENT_DURATION,
|
MAX_SEGMENT_DURATION,
|
||||||
MAX_SEGMENTS_IN_CACHE,
|
MAX_SEGMENTS_IN_CACHE,
|
||||||
PORT_INTER_PROCESS_COMM,
|
|
||||||
RECORD_DIR,
|
RECORD_DIR,
|
||||||
)
|
)
|
||||||
from frigate.models import Event, Recordings
|
from frigate.models import Event, Recordings
|
||||||
@ -71,10 +70,7 @@ class RecordingMaintainer(threading.Thread):
|
|||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
# create communication for retained recordings
|
# create communication for retained recordings
|
||||||
INTER_PROCESS_COMM_PORT = (
|
self.requestor = InterProcessRequestor()
|
||||||
os.environ.get("INTER_PROCESS_COMM_PORT") or PORT_INTER_PROCESS_COMM
|
|
||||||
)
|
|
||||||
self.requestor = InterProcessRequestor(INTER_PROCESS_COMM_PORT)
|
|
||||||
|
|
||||||
self.object_recordings_info_queue = object_recordings_info_queue
|
self.object_recordings_info_queue = object_recordings_info_queue
|
||||||
self.audio_recordings_info_queue = audio_recordings_info_queue
|
self.audio_recordings_info_queue = audio_recordings_info_queue
|
||||||
|
|||||||
@ -18,7 +18,6 @@ from frigate.const import (
|
|||||||
ATTRIBUTE_LABEL_MAP,
|
ATTRIBUTE_LABEL_MAP,
|
||||||
CACHE_DIR,
|
CACHE_DIR,
|
||||||
CACHE_SEGMENT_FORMAT,
|
CACHE_SEGMENT_FORMAT,
|
||||||
PORT_INTER_PROCESS_COMM,
|
|
||||||
REQUEST_REGION_GRID,
|
REQUEST_REGION_GRID,
|
||||||
)
|
)
|
||||||
from frigate.log import LogPipe
|
from frigate.log import LogPipe
|
||||||
@ -433,11 +432,8 @@ def track_camera(
|
|||||||
|
|
||||||
frame_manager = SharedMemoryFrameManager()
|
frame_manager = SharedMemoryFrameManager()
|
||||||
|
|
||||||
# create communication for finished previews
|
# create communication for region grid updates
|
||||||
INTER_PROCESS_COMM_PORT = (
|
requestor = InterProcessRequestor()
|
||||||
os.environ.get("INTER_PROCESS_COMM_PORT") or PORT_INTER_PROCESS_COMM
|
|
||||||
)
|
|
||||||
requestor = InterProcessRequestor(INTER_PROCESS_COMM_PORT)
|
|
||||||
|
|
||||||
process_frames(
|
process_frames(
|
||||||
name,
|
name,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user