mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
Format changes with Black
This commit is contained in:
parent
8390f054ac
commit
21f00b3858
@ -98,14 +98,14 @@ class Dispatcher:
|
||||
def _on_capture_command(self, camera_name: str, payload: str) -> None:
|
||||
"""Callback for detect topic."""
|
||||
logger.info(f"Received capture command [{payload}] for [{camera_name}]")
|
||||
capture_proc = self.camera_metrics[camera_name]['capture_process']
|
||||
capture_proc = self.camera_metrics[camera_name]["capture_process"]
|
||||
|
||||
# Send SIGUSR1 to resume, SIGUSR2 to pause
|
||||
new_state = True if payload == "ON" else False if payload == "OFF" else None
|
||||
if new_state is not None:
|
||||
sig = signal.SIGUSR1 if new_state else signal.SIGUSR2
|
||||
self.config.cameras[camera_name].capture_enabled = new_state
|
||||
os.kill( capture_proc.pid, sig )
|
||||
os.kill(capture_proc.pid, sig)
|
||||
self.publish(f"{camera_name}/capture/state", payload, retain=True)
|
||||
|
||||
def _on_detect_command(self, camera_name: str, payload: str) -> None:
|
||||
|
||||
@ -641,7 +641,7 @@ def terminate_process(
|
||||
proc: sp.Popen, logger_inst: logging.Logger = None, timeout: float = 30.0
|
||||
):
|
||||
logger_inst = logger_inst or logger
|
||||
if proc is not None and proc.poll() == None:
|
||||
if proc is not None and proc.poll() is None:
|
||||
proc_name: str = proc.args[0]
|
||||
logger_inst.info(f"Terminating the existing {proc_name} process...")
|
||||
proc.terminate()
|
||||
|
||||
@ -113,10 +113,11 @@ def create_tensor_input(frame, model_config, region):
|
||||
# Expand dimensions since the model expects images to have shape: [1, height, width, 3]
|
||||
return np.expand_dims(cropped_frame, axis=0)
|
||||
|
||||
|
||||
def start_or_restart_ffmpeg(
|
||||
ffmpeg_cmd, logger, logpipe: LogPipe, frame_size=None, ffmpeg_process=None
|
||||
):
|
||||
terminate_process( ffmpeg_process, logger_inst=logger )
|
||||
terminate_process(ffmpeg_process, logger_inst=logger)
|
||||
|
||||
if frame_size is None:
|
||||
process = sp.Popen(
|
||||
@ -386,12 +387,12 @@ def capture_camera(name, config: CameraConfig, process_info):
|
||||
|
||||
def receiveSignal(signalNumber, frame):
|
||||
logger.info(f"{name} Received signal {signalNumber}")
|
||||
sig_queue.put( signalNumber )
|
||||
sig_queue.put(signalNumber)
|
||||
if signalNumber in (stop_sigs + pause_sigs):
|
||||
stop_event.set()
|
||||
|
||||
signal.signal(signal.SIGTERM, receiveSignal)
|
||||
signal.signal(signal.SIGINT, receiveSignal)
|
||||
signal.signal(signal.SIGINT, receiveSignal)
|
||||
signal.signal(signal.SIGUSR1, receiveSignal)
|
||||
signal.signal(signal.SIGUSR2, receiveSignal)
|
||||
|
||||
@ -407,7 +408,7 @@ def capture_camera(name, config: CameraConfig, process_info):
|
||||
# Pause here until stopped or resumed
|
||||
while not sig_queue.empty() or prev_sig not in resume_sigs:
|
||||
# Abort on a STOP signal
|
||||
if( prev_sig := sig_queue.get() ) in stop_sigs:
|
||||
if (prev_sig := sig_queue.get()) in stop_sigs:
|
||||
break
|
||||
|
||||
logger.info(f"{name}: capture starting")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user