mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-01 16:55:21 +03:00
improved user experience
This commit is contained in:
parent
8652b454bb
commit
b587e83327
@ -519,8 +519,19 @@ def clipped(obj, frame_shape):
|
||||
return False
|
||||
|
||||
|
||||
def restart_frigate():
|
||||
os.kill(os.getpid(), signal.SIGTERM)
|
||||
def restart_frigate(mqtt_client, topic_prefix, from_ui = 0):
|
||||
|
||||
def on_publish(client,userdata,result):
|
||||
time.sleep(0.67)
|
||||
rc, docker = 1, "/usr/local/bin/docker"
|
||||
if os.access(docker, os.X_OK) and os.path.isfile("/var/run/docker.sock"):
|
||||
rc = sp.Popen(f"{docker} restart $(hostname)", shell=True).wait()
|
||||
if rc:
|
||||
# Sometimes you have to wait a long time like this
|
||||
os.kill(os.getpid(), signal.SIGTERM)
|
||||
|
||||
mqtt_client.on_publish = on_publish
|
||||
mqtt_client.publish(f"{topic_prefix}/restarted", int(from_ui))
|
||||
|
||||
|
||||
class EventsPerSecond:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user