|
@@ -16,7 +16,6 @@ app = FastAPI()
|
|
|
|
|
|
conf = Config.get("prod")
|
|
|
url = conf["url"]
|
|
|
-channel = conf["channel"]
|
|
|
classIndex = conf["classIndex"]
|
|
|
nvr = conf["nvr"]
|
|
|
|
|
@@ -39,6 +38,7 @@ async def speed(request: Request):
|
|
|
videoTime = info["dateTime"]
|
|
|
speed = info["VehicleInfo"]["vehicleSpeed"]
|
|
|
plate = info["PlateInfo"]["plate"]
|
|
|
+ ip_addr = info["ipAddress"]
|
|
|
filename = None
|
|
|
imagedata = None
|
|
|
filename = image_content["filename"]
|
|
@@ -50,7 +50,11 @@ async def speed(request: Request):
|
|
|
text = f"{plate} : {speed} km/h"
|
|
|
draw(img, text, (100, 100))
|
|
|
byte_data = pil2byte(img)
|
|
|
- res = await upload(url, channel, classIndex, nvr, videoTime, filename, byte_data, plate, speed)
|
|
|
+ if ip_addr not in conf["ip2channle"]:
|
|
|
+ logger.info(f"{ip_addr} not in ip2channle")
|
|
|
+ return
|
|
|
+ channel = conf["ip2channle"][ip_addr]
|
|
|
+ res = await upload(url, ip_addr, classIndex, nvr, videoTime, filename, byte_data, plate, speed)
|
|
|
logger.info(res)
|
|
|
except Exception as error:
|
|
|
logger.info(error)
|