mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 01:05:20 +03:00
improved user experience
This commit is contained in:
parent
8652b454bb
commit
b587e83327
@ -519,9 +519,20 @@ def clipped(obj, frame_shape):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def restart_frigate():
|
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)
|
os.kill(os.getpid(), signal.SIGTERM)
|
||||||
|
|
||||||
|
mqtt_client.on_publish = on_publish
|
||||||
|
mqtt_client.publish(f"{topic_prefix}/restarted", int(from_ui))
|
||||||
|
|
||||||
|
|
||||||
class EventsPerSecond:
|
class EventsPerSecond:
|
||||||
def __init__(self, max_events=1000):
|
def __init__(self, max_events=1000):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user