mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-23 19:11:14 +01:00
lint fixes
This commit is contained in:
parent
0044f73d7a
commit
ec91466fe4
@ -93,8 +93,8 @@ class FrigateApp:
|
||||
"i", self.config.cameras[camera_name].detect.enabled
|
||||
),
|
||||
"improve_contrast_enabled": mp.Value(
|
||||
"i", self.config.cameras[camera_name].motion.improve_contrast
|
||||
),
|
||||
"i", self.config.cameras[camera_name].motion.improve_contrast
|
||||
),
|
||||
"detection_fps": mp.Value("d", 0.0),
|
||||
"detection_frame": mp.Value("d", 0.0),
|
||||
"read_start": mp.Value("d", 0.0),
|
||||
|
@ -43,9 +43,11 @@ class DetectorConfig(FrigateBaseModel):
|
||||
device: str = Field(default="usb", title="Device Type")
|
||||
num_threads: int = Field(default=3, title="Number of detection threads")
|
||||
|
||||
|
||||
class UIConfig(FrigateBaseModel):
|
||||
use_experimental: bool = Field(default=False, title="Experimental UI")
|
||||
|
||||
|
||||
class MqttConfig(FrigateBaseModel):
|
||||
host: str = Field(title="MQTT Host")
|
||||
port: int = Field(default=1883, title="MQTT Port")
|
||||
@ -516,7 +518,9 @@ class CameraLiveConfig(FrigateBaseModel):
|
||||
|
||||
class CameraUiConfig(FrigateBaseModel):
|
||||
order: int = Field(default=0, title="Order of camera in UI.")
|
||||
dashboard: bool = Field(default=True, title="Show this camera in Frigate dashboard UI.")
|
||||
dashboard: bool = Field(
|
||||
default=True, title="Show this camera in Frigate dashboard UI."
|
||||
)
|
||||
|
||||
|
||||
class CameraConfig(FrigateBaseModel):
|
||||
|
@ -14,22 +14,22 @@ from frigate.models import Event
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def should_insert_db(prev_event, current_event):
|
||||
"""If current event has new clip or snapshot."""
|
||||
return (
|
||||
(not prev_event["has_clip"] and not prev_event["has_snapshot"])
|
||||
and (current_event["has_clip"] or current_event["has_snapshot"])
|
||||
return (not prev_event["has_clip"] and not prev_event["has_snapshot"]) and (
|
||||
current_event["has_clip"] or current_event["has_snapshot"]
|
||||
)
|
||||
|
||||
|
||||
def should_update_db(prev_event, current_event):
|
||||
"""If current_event has updated fields and (clip or snapshot)."""
|
||||
return (
|
||||
(current_event["has_clip"] or current_event["has_snapshot"])
|
||||
and (prev_event["top_score"] != current_event["top_score"]
|
||||
or prev_event["entered_zones"] != current_event["entered_zones"]
|
||||
or prev_event["thumbnail"] != current_event["thumbnail"]
|
||||
or prev_event["has_clip"] != current_event["has_clip"]
|
||||
or prev_event["has_snapshot"] != current_event["has_snapshot"])
|
||||
return (current_event["has_clip"] or current_event["has_snapshot"]) and (
|
||||
prev_event["top_score"] != current_event["top_score"]
|
||||
or prev_event["entered_zones"] != current_event["entered_zones"]
|
||||
or prev_event["thumbnail"] != current_event["thumbnail"]
|
||||
or prev_event["has_clip"] != current_event["has_clip"]
|
||||
or prev_event["has_snapshot"] != current_event["has_snapshot"]
|
||||
)
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
|
||||
logger.warning(f"Received unsupported value at {message.topic}: {payload}")
|
||||
|
||||
state_topic = f"{message.topic[:-4]}/state"
|
||||
client.publish(state_topic, payload, retain=True)
|
||||
client.publish(state_topic, payload, retain=True)
|
||||
|
||||
def on_restart_command(client, userdata, message):
|
||||
restart_frigate()
|
||||
@ -120,9 +120,13 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
|
||||
threading.current_thread().name = "mqtt"
|
||||
if rc != 0:
|
||||
if rc == 3:
|
||||
logger.error("Unable to connect to MQTT server: MQTT Server unavailable")
|
||||
logger.error(
|
||||
"Unable to connect to MQTT server: MQTT Server unavailable"
|
||||
)
|
||||
elif rc == 4:
|
||||
logger.error("Unable to connect to MQTT server: MQTT Bad username or password")
|
||||
logger.error(
|
||||
"Unable to connect to MQTT server: MQTT Bad username or password"
|
||||
)
|
||||
elif rc == 5:
|
||||
logger.error("Unable to connect to MQTT server: MQTT Not authorized")
|
||||
else:
|
||||
@ -153,7 +157,8 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
|
||||
f"{mqtt_config.topic_prefix}/{name}/detect/set", on_detect_command
|
||||
)
|
||||
client.message_callback_add(
|
||||
f"{mqtt_config.topic_prefix}/{name}/improve_contrast/set", on_improve_contrast_command
|
||||
f"{mqtt_config.topic_prefix}/{name}/improve_contrast/set",
|
||||
on_improve_contrast_command,
|
||||
)
|
||||
|
||||
client.message_callback_add(
|
||||
@ -204,7 +209,7 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
|
||||
f"{mqtt_config.topic_prefix}/{name}/improve_contrast/state",
|
||||
"ON" if config.cameras[name].motion.improve_contrast else "OFF",
|
||||
retain=True,
|
||||
)
|
||||
)
|
||||
|
||||
return client
|
||||
|
||||
|
@ -15,7 +15,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_latest_version() -> str:
|
||||
request = requests.get('https://api.github.com/repos/blakeblackshear/frigate/releases/latest')
|
||||
request = requests.get(
|
||||
"https://api.github.com/repos/blakeblackshear/frigate/releases/latest"
|
||||
)
|
||||
response = request.json()
|
||||
|
||||
if request.ok and response:
|
||||
|
@ -368,7 +368,9 @@ def track_camera(
|
||||
objects_to_track = config.objects.track
|
||||
object_filters = config.objects.filters
|
||||
|
||||
motion_detector = MotionDetector(frame_shape, config.motion, improve_contrast_enabled)
|
||||
motion_detector = MotionDetector(
|
||||
frame_shape, config.motion, improve_contrast_enabled
|
||||
)
|
||||
object_detector = RemoteObjectDetector(
|
||||
name, labelmap, detection_queue, result_connection, model_shape
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user