update
This commit is contained in:
parent
d1d2161c72
commit
7e738c71f9
2
MQTT.py
2
MQTT.py
|
@ -79,4 +79,4 @@ if __name__ == '__main__':
|
|||
MQTT.start()
|
||||
MQTT.client.loop_forever()
|
||||
except:
|
||||
time.sleep(15)
|
||||
time.sleep(30)
|
||||
|
|
27
tool.py
27
tool.py
|
@ -8,19 +8,22 @@ mp4_path = '/home/pi/mp4'
|
|||
|
||||
|
||||
def push_stream(client):
|
||||
p = subprocess.Popen(['/bin/bash /home/pi/lot_manager/bash/start_push_stream.sh'], shell=True,
|
||||
p = subprocess.Popen(['/bin/bash /home/pi/lot_manager/bash/start_push_stream.sh'],
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
output = out.decode('utf-8')
|
||||
output = out.decode('utf-8').strip()
|
||||
client.publish('success', payload=json.dumps(output, ensure_ascii=False), qos=0)
|
||||
|
||||
|
||||
def close_stream(client):
|
||||
p = subprocess.Popen(['/bin/bash /home/pi/lot_manager/bash/stop_push_stream.sh'], shell=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(['/bin/bash /home/pi/lot_manager/bash/stop_push_stream.sh'],
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
output = out.decode('utf-8')
|
||||
output = out.decode('utf-8').strip()
|
||||
client.publish('success', payload=json.dumps(output, ensure_ascii=False), qos=0)
|
||||
|
||||
|
||||
|
@ -38,14 +41,17 @@ def exec_sh(msg, client):
|
|||
return
|
||||
p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
output = out.decode('utf-8')
|
||||
output = out.decode('utf-8').strip()
|
||||
client.publish('success', payload=json.dumps(output, ensure_ascii=False), qos=0)
|
||||
|
||||
|
||||
def get_status(client):
|
||||
p = subprocess.Popen(['supervisorctl status'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(['supervisorctl status'],
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
output = out.decode('utf-8')
|
||||
output = out.decode('utf-8').strip()
|
||||
client.publish('success', payload=json.dumps(output, ensure_ascii=False), qos=0)
|
||||
|
||||
|
||||
|
@ -55,14 +61,13 @@ def update(client):
|
|||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
output = out.decode('utf-8')
|
||||
output = out.decode('utf-8').strip()
|
||||
client.publish('success', payload=json.dumps(output, ensure_ascii=False), qos=0)
|
||||
|
||||
|
||||
def get_list_record():
|
||||
data = {
|
||||
"data": os.listdir(mp4_path),
|
||||
"device_name": os.getenv("device_name")
|
||||
"data": os.listdir(mp4_path)
|
||||
}
|
||||
requests.post("http://shop.lihaink.cn/api/index/file_list", json=data)
|
||||
|
||||
|
|
Loading…
Reference in New Issue