This commit is contained in:
xyj 2023-12-14 09:29:24 +08:00
parent 82ff013919
commit 7a6f33fcac
2 changed files with 7 additions and 7 deletions

View File

@ -15,6 +15,9 @@ config.read('conf/main/common.conf')
broker = config.get("broker", "host")
# 端口这里必须是int类型
port = config.getint("broker", "port")
# 录像地址
post_record_list_url = config.get("record", "post_record_list_url")
post_record_url = config.get("record", "post_record_url")
# 读取设备配置
config.read('conf/device/device.conf')
@ -27,7 +30,8 @@ username = config.get(device_name, "username")
# 密码
password = config.get(device_name, "password")
# 特殊配置
config.read('conf/zhanguan/topic.conf')
zhanguan_device_name = config.get("device", "name")
# tool配置
mp4_path = '/home/pi/mp4'

View File

@ -1,13 +1,10 @@
import configparser
import json
import os
import subprocess
import requests
mp4_path = '/home/pi/mp4'
config = configparser.ConfigParser()
config.read('/home/pi/lot_manager/conf/main/common.conf')
from config import mp4_path, post_record_list_url, post_record_url
def push_stream(client):
@ -72,7 +69,6 @@ def get_list_record():
data = {
"data": os.listdir(mp4_path)
}
post_record_list_url = config.get("record", "post_record_list_url")
requests.post(post_record_list_url, json=data)
@ -81,6 +77,6 @@ def get_record(msg, client):
if filename is None or filename == '':
client.publish('error', payload='没有该文件', qos=0)
return
post_record_url = config.get("record", "post_record_url")
files = {filename: open(os.path.join(mp4_path, filename), 'rb'), "Content-Type": "application/octet-stream"}
requests.post(post_record_url, files=files)