mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
lint fixes
This commit is contained in:
parent
0044f73d7a
commit
ec91466fe4
@ -43,9 +43,11 @@ class DetectorConfig(FrigateBaseModel):
|
|||||||
device: str = Field(default="usb", title="Device Type")
|
device: str = Field(default="usb", title="Device Type")
|
||||||
num_threads: int = Field(default=3, title="Number of detection threads")
|
num_threads: int = Field(default=3, title="Number of detection threads")
|
||||||
|
|
||||||
|
|
||||||
class UIConfig(FrigateBaseModel):
|
class UIConfig(FrigateBaseModel):
|
||||||
use_experimental: bool = Field(default=False, title="Experimental UI")
|
use_experimental: bool = Field(default=False, title="Experimental UI")
|
||||||
|
|
||||||
|
|
||||||
class MqttConfig(FrigateBaseModel):
|
class MqttConfig(FrigateBaseModel):
|
||||||
host: str = Field(title="MQTT Host")
|
host: str = Field(title="MQTT Host")
|
||||||
port: int = Field(default=1883, title="MQTT Port")
|
port: int = Field(default=1883, title="MQTT Port")
|
||||||
@ -516,7 +518,9 @@ class CameraLiveConfig(FrigateBaseModel):
|
|||||||
|
|
||||||
class CameraUiConfig(FrigateBaseModel):
|
class CameraUiConfig(FrigateBaseModel):
|
||||||
order: int = Field(default=0, title="Order of camera in UI.")
|
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):
|
class CameraConfig(FrigateBaseModel):
|
||||||
|
@ -14,22 +14,22 @@ from frigate.models import Event
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def should_insert_db(prev_event, current_event):
|
def should_insert_db(prev_event, current_event):
|
||||||
"""If current event has new clip or snapshot."""
|
"""If current event has new clip or snapshot."""
|
||||||
return (
|
return (not prev_event["has_clip"] and not prev_event["has_snapshot"]) and (
|
||||||
(not prev_event["has_clip"] and not prev_event["has_snapshot"])
|
current_event["has_clip"] or current_event["has_snapshot"]
|
||||||
and (current_event["has_clip"] or current_event["has_snapshot"])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def should_update_db(prev_event, current_event):
|
def should_update_db(prev_event, current_event):
|
||||||
"""If current_event has updated fields and (clip or snapshot)."""
|
"""If current_event has updated fields and (clip or snapshot)."""
|
||||||
return (
|
return (current_event["has_clip"] or current_event["has_snapshot"]) and (
|
||||||
(current_event["has_clip"] or current_event["has_snapshot"])
|
prev_event["top_score"] != current_event["top_score"]
|
||||||
and (prev_event["top_score"] != current_event["top_score"]
|
or prev_event["entered_zones"] != current_event["entered_zones"]
|
||||||
or prev_event["entered_zones"] != current_event["entered_zones"]
|
or prev_event["thumbnail"] != current_event["thumbnail"]
|
||||||
or prev_event["thumbnail"] != current_event["thumbnail"]
|
or prev_event["has_clip"] != current_event["has_clip"]
|
||||||
or prev_event["has_clip"] != current_event["has_clip"]
|
or prev_event["has_snapshot"] != current_event["has_snapshot"]
|
||||||
or prev_event["has_snapshot"] != current_event["has_snapshot"])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,9 +120,13 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
|
|||||||
threading.current_thread().name = "mqtt"
|
threading.current_thread().name = "mqtt"
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
if rc == 3:
|
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:
|
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:
|
elif rc == 5:
|
||||||
logger.error("Unable to connect to MQTT server: MQTT Not authorized")
|
logger.error("Unable to connect to MQTT server: MQTT Not authorized")
|
||||||
else:
|
else:
|
||||||
@ -153,7 +157,8 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
|
|||||||
f"{mqtt_config.topic_prefix}/{name}/detect/set", on_detect_command
|
f"{mqtt_config.topic_prefix}/{name}/detect/set", on_detect_command
|
||||||
)
|
)
|
||||||
client.message_callback_add(
|
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(
|
client.message_callback_add(
|
||||||
|
@ -15,7 +15,9 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def get_latest_version() -> str:
|
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()
|
response = request.json()
|
||||||
|
|
||||||
if request.ok and response:
|
if request.ok and response:
|
||||||
|
@ -368,7 +368,9 @@ def track_camera(
|
|||||||
objects_to_track = config.objects.track
|
objects_to_track = config.objects.track
|
||||||
object_filters = config.objects.filters
|
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(
|
object_detector = RemoteObjectDetector(
|
||||||
name, labelmap, detection_queue, result_connection, model_shape
|
name, labelmap, detection_queue, result_connection, model_shape
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user