update
This commit is contained in:
parent
82ff013919
commit
7a6f33fcac
|
@ -15,6 +15,9 @@ config.read('conf/main/common.conf')
|
||||||
broker = config.get("broker", "host")
|
broker = config.get("broker", "host")
|
||||||
# 端口,这里必须是int类型
|
# 端口,这里必须是int类型
|
||||||
port = config.getint("broker", "port")
|
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')
|
config.read('conf/device/device.conf')
|
||||||
|
@ -27,7 +30,8 @@ username = config.get(device_name, "username")
|
||||||
# 密码
|
# 密码
|
||||||
password = config.get(device_name, "password")
|
password = config.get(device_name, "password")
|
||||||
|
|
||||||
|
|
||||||
# 特殊配置
|
# 特殊配置
|
||||||
config.read('conf/zhanguan/topic.conf')
|
config.read('conf/zhanguan/topic.conf')
|
||||||
zhanguan_device_name = config.get("device", "name")
|
zhanguan_device_name = config.get("device", "name")
|
||||||
|
# tool配置
|
||||||
|
mp4_path = '/home/pi/mp4'
|
8
tool.py
8
tool.py
|
@ -1,13 +1,10 @@
|
||||||
import configparser
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
mp4_path = '/home/pi/mp4'
|
from config import mp4_path, post_record_list_url, post_record_url
|
||||||
config = configparser.ConfigParser()
|
|
||||||
config.read('/home/pi/lot_manager/conf/main/common.conf')
|
|
||||||
|
|
||||||
|
|
||||||
def push_stream(client):
|
def push_stream(client):
|
||||||
|
@ -72,7 +69,6 @@ def get_list_record():
|
||||||
data = {
|
data = {
|
||||||
"data": os.listdir(mp4_path)
|
"data": os.listdir(mp4_path)
|
||||||
}
|
}
|
||||||
post_record_list_url = config.get("record", "post_record_list_url")
|
|
||||||
requests.post(post_record_list_url, json=data)
|
requests.post(post_record_list_url, json=data)
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,6 +77,6 @@ def get_record(msg, client):
|
||||||
if filename is None or filename == '':
|
if filename is None or filename == '':
|
||||||
client.publish('error', payload='没有该文件', qos=0)
|
client.publish('error', payload='没有该文件', qos=0)
|
||||||
return
|
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"}
|
files = {filename: open(os.path.join(mp4_path, filename), 'rb'), "Content-Type": "application/octet-stream"}
|
||||||
requests.post(post_record_url, files=files)
|
requests.post(post_record_url, files=files)
|
||||||
|
|
Loading…
Reference in New Issue