Skip to content

NVR with realtime local object detection for IP cameras

Add languages (#21870)

Josh Hawkins21e4b36c7c25
diff --git a/frigate/api/classification.py b/frigate/api/classification.py
index ed1e7b3179..5e1087d17c 100644
--- a/frigate/api/classification.py
+++ b/frigate/api/classification.py
@@ -73,7 +73,7 @@ def get_faces():
face_dict[name] = []
for file in filter(
- lambda f: (f.lower().endswith((".webp", ".png", ".jpg", ".jpeg"))),
+ lambda f: f.lower().endswith((".webp", ".png", ".jpg", ".jpeg")),
os.listdir(face_dir),
):
face_dict[name].append(file)
@@ -582,7 +582,7 @@ def get_classification_dataset(name: str):
dataset_dict[category_name] = []
for file in filter(
- lambda f: (f.lower().endswith((".webp", ".png", ".jpg", ".jpeg"))),
+ lambda f: f.lower().endswith((".webp", ".png", ".jpg", ".jpeg")),
os.listdir(category_dir),
):
dataset_dict[category_name].append(file)
@@ -693,7 +693,7 @@ def get_classification_images(name: str):
status_code=200,
content=list(
filter(
- lambda f: (f.lower().endswith((".webp", ".png", ".jpg", ".jpeg"))),
+ lambda f: f.lower().endswith((".webp", ".png", ".jpg", ".jpeg")),
os.listdir(train_dir),
)
),
diff --git a/frigate/data_processing/real_time/custom_classification.py b/frigate/data_processing/real_time/custom_classification.py
index 5a58cf1229..53a898de3b 100644
--- a/frigate/data_processing/real_time/custom_classification.py
+++ b/frigate/data_processing/real_time/custom_classification.py
@@ -695,7 +695,7 @@ def write_classification_attempt(
# delete oldest face image if maximum is reached
try:
files = sorted(
- filter(lambda f: (f.endswith(".webp")), os.listdir(folder)),
+ filter(lambda f: f.endswith(".webp"), os.listdir(folder)),
key=lambda f: os.path.getctime(os.path.join(folder, f)),
reverse=True,
)
diff --git a/frigate/data_processing/real_time/face.py b/frigate/data_processing/real_time/face.py
index 1901a81e19..e1c11bf113 100644
--- a/frigate/data_processing/real_time/face.py
+++ b/frigate/data_processing/real_time/face.py
@@ -539,7 +539,7 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
cv2.imwrite(file, frame)
files = sorted(
- filter(lambda f: (f.endswith(".webp")), os.listdir(folder)),
+ filter(lambda f: f.endswith(".webp"), os.listdir(folder)),
key=lambda f: os.path.getctime(os.path.join(folder, f)),
reverse=True,
)
diff --git a/frigate/log.py b/frigate/log.py
index 5cec0e0d89..cd475a4bdb 100644
--- a/frigate/log.py
+++ b/frigate/log.py
@@ -26,15 +26,16 @@ LOG_HANDLER.setFormatter(
# filter out norfair warning
LOG_HANDLER.addFilter(
- lambda record: not record.getMessage().startswith(
- "You are using a scalar distance function"
+ lambda record: (
+ not record.getMessage().startswith("You are using a scalar distance function")
)
)
# filter out tflite logging
LOG_HANDLER.addFilter(
- lambda record: "Created TensorFlow Lite XNNPACK delegate for CPU."
- not in record.getMessage()
+ lambda record: (
+ "Created TensorFlow Lite XNNPACK delegate for CPU." not in record.getMessage()
+ )
)
diff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.py
index 25c9d2cff1..a90d1edc12 100644
--- a/frigate/record/maintainer.py
+++ b/frigate/record/maintainer.py
@@ -208,8 +208,10 @@ class RecordingMaintainer(threading.Thread):
processed_segment_count = len(
list(
filter(
- lambda r: r["start_time"].timestamp()
- < most_recently_processed_frame_time,
+ lambda r: (
+ r["start_time"].timestamp()
+ < most_recently_processed_frame_time
+ ),
grouped_recordings[camera],
)
)
diff --git a/web/public/locales/en/common.json b/web/public/locales/en/common.json
index 8bf13ca610..300f74ddba 100644
--- a/web/public/locales/en/common.json
+++ b/web/public/locales/en/common.json
@@ -193,6 +193,7 @@
"yue": "粵語 (Cantonese)",
"th": "ไทย (Thai)",
"ca": "Català (Catalan)",
+ "hr": "Hrvatski (Croatian)",
"sr": "Српски (Serbian)",
"sl": "Slovenščina (Slovenian)",
"lt": "Lietuvių (Lithuanian)",
diff --git a/web/src/hooks/use-date-locale.ts b/web/src/hooks/use-date-locale.ts
index 3c88774b71..7a80856668 100644
--- a/web/src/hooks/use-date-locale.ts
+++ b/web/src/hooks/use-date-locale.ts
@@ -37,6 +37,7 @@ const localeMap: Record<string, () => Promise<Locale>> = {
lt: () => import("date-fns/locale/lt").then((module) => module.lt),
th: () => import("date-fns/locale/th").then((module) => module.th),
ca: () => import("date-fns/locale/ca").then((module) => module.ca),
+ hr: () => import("date-fns/locale/hr").then((module) => module.hr),
};
export function useDateLocale(): Locale {
diff --git a/web/src/lib/const.ts b/web/src/lib/const.ts
index ad35d5ae35..df95cbe1e0 100644
--- a/web/src/lib/const.ts
+++ b/web/src/lib/const.ts
@@ -17,9 +17,12 @@ export const supportedLanguageKeys = [
"vi",
"th",
"he",
+ "fa",
"ru",
"tr",
"pl",
+ "hr",
+ "sk",
"lt",
"uk",
"cs",