添加typeName

This commit is contained in:
quantulr
2024-03-18 16:59:31 +08:00
parent f061366606
commit 1563c52d11
2 changed files with 5 additions and 5 deletions

View File

@ -63,8 +63,7 @@ async def read_event():
src_index = event_detail["srcIndex"] src_index = event_detail["srcIndex"]
device_name = device_map.get(src_index, "未知设备") device_name = device_map.get(src_index, "未知设备")
event_detail["deviceName"] = device_name event_detail["deviceName"] = device_name
# 添加regionName和typeName # 添加regionName
event_detail["typeName"] = event_type_str
if "srcName" in event_detail: if "srcName" in event_detail:
event_detail["regionName"] = event_detail["srcName"] event_detail["regionName"] = event_detail["srcName"]
else: else:
@ -96,6 +95,7 @@ async def read_event():
event_detail["data"]["_detectionResult"] = ( event_detail["data"]["_detectionResult"] = (
event_detail["data"].pop(detection_field_name) event_detail["data"].pop(detection_field_name)
) )
event_detail["data"]["_detectionResult"]["typeName"] = event_type_str
if isinstance( if isinstance(
event_detail["data"]["_detectionResult"], list event_detail["data"]["_detectionResult"], list
) and len(event_detail["data"]["_detectionResult"]): ) and len(event_detail["data"]["_detectionResult"]):
@ -125,8 +125,7 @@ async def read_event():
# 添加设备名称 # 添加设备名称
src_index = event["srcIndex"] src_index = event["srcIndex"]
device_name = device_map.get(src_index, "未知设备") device_name = device_map.get(src_index, "未知设备")
# 添加regionName和typeName # 添加regionName
event["typeName"] = event_type_str
if "srcName" in event: if "srcName" in event:
event["regionName"] = event["srcName"] event["regionName"] = event["srcName"]
else: else:
@ -159,6 +158,7 @@ async def read_event():
event["data"]["_detectionResult"] = event["data"].pop( event["data"]["_detectionResult"] = event["data"].pop(
detection_field_name detection_field_name
) )
event["data"]["_detectionResult"]["typeName"] = event_type_str
if isinstance( if isinstance(
event["data"]["_detectionResult"], list event["data"]["_detectionResult"], list
) and len(event["data"]["_detectionResult"]): ) and len(event["data"]["_detectionResult"]):

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "hik-push" name = "hik-push"
version = "1.0.0" version = "1.0.1"
description = "" description = ""
authors = ["quantulr <35954003+quantulr@users.noreply.github.com>"] authors = ["quantulr <35954003+quantulr@users.noreply.github.com>"]
readme = "README.md" readme = "README.md"