From 76ac260bf759df2ed830b3e00dfa9ed7c87789a2 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Tue, 4 Feb 2025 07:45:33 -0800 Subject: [PATCH] hikvision: fix unhandled rejection parsing camera object detection --- plugins/hikvision/package-lock.json | 4 ++-- plugins/hikvision/package.json | 2 +- plugins/hikvision/src/main.ts | 9 ++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/plugins/hikvision/package-lock.json b/plugins/hikvision/package-lock.json index 773739044..a82431219 100644 --- a/plugins/hikvision/package-lock.json +++ b/plugins/hikvision/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/hikvision", - "version": "0.0.161", + "version": "0.0.162", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/hikvision", - "version": "0.0.161", + "version": "0.0.162", "license": "Apache", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/hikvision/package.json b/plugins/hikvision/package.json index 715467cc9..5e9ee968b 100644 --- a/plugins/hikvision/package.json +++ b/plugins/hikvision/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/hikvision", - "version": "0.0.161", + "version": "0.0.162", "description": "Hikvision Plugin for Scrypted", "author": "Scrypted", "license": "Apache", diff --git a/plugins/hikvision/src/main.ts b/plugins/hikvision/src/main.ts index 9b17e9f18..5573f4ea9 100644 --- a/plugins/hikvision/src/main.ts +++ b/plugins/hikvision/src/main.ts @@ -161,14 +161,9 @@ export class HikvisionCamera extends RtspSmartCamera implements Camera, Intercom const now = Date.now(); let detections: ObjectDetectionResult[] = xml.EventNotificationAlert?.DetectionRegionList?.map(region => { - const { DetectionRegionEntry } = region; - const dre = DetectionRegionEntry[0]; - if (!DetectionRegionEntry) + const name = region?.DetectionRegionEntry?.[0]?.detectionTarget?.name; + if (!name) return; - const { detectionTarget } = dre; - // const { TargetRect } = dre; - // const { X, Y, width, height } = TargetRect[0]; - const [name] = detectionTarget; return { score: 1, className: detectionMap[name] || name,