This commit is contained in:
xyj 2023-12-14 10:51:16 +08:00
parent dd16d45784
commit 62c5fa2f1f
3 changed files with 8 additions and 5 deletions

View File

@ -60,7 +60,7 @@ class MQTTClient:
reload(client)
elif data == "record_list":
# 查看录像列表
get_list_record()
get_list_record(client)
elif data == "record":
# 获取录像
get_record(msg, client)

View File

@ -24,7 +24,8 @@ class DataUploadClient:
def on_connect(self, client, userdata, flags, rc):
global times
times = 6
self.client.publish('success', payload='连接成功,执行数据推送和本地存储' + str(time.time()), qos=0)
self.client.publish('success', payload=subscribe_topic + ':连接成功,执行数据推送和本地存储' + str(time.time()),
qos=0)
subprocess.Popen(['/usr/bin/bash /home/pi/lot_manager/bash/start_data_upload.sh'], shell=True)
def on_disconnect(self, client, userdata, rc):

View File

@ -72,11 +72,12 @@ def reload(client):
subprocess.Popen(['supervisorctl reload'], shell=True)
def get_list_record():
def get_list_record(client):
data = {
"data": os.listdir(mp4_path)
}
requests.post(post_record_list_url, json=data)
r = requests.post(post_record_list_url, json=data)
client.publish('success', payload=str(r), qos=0)
def get_record(msg, client):
@ -86,4 +87,5 @@ def get_record(msg, client):
return
files = {filename: open(os.path.join(mp4_path, filename), 'rb'), "Content-Type": "application/octet-stream"}
requests.post(post_record_url, files=files)
r = requests.post(post_record_url, files=files)
client.publish('success', payload=str(r), qos=0)