a
This commit is contained in:
@@ -40,12 +40,14 @@ def to_seconds(t):
|
|||||||
def update():
|
def update():
|
||||||
global LAST_VALUE
|
global LAST_VALUE
|
||||||
data = get_data()
|
data = get_data()
|
||||||
|
if data is not None and data["noshutdown"] == 1:
|
||||||
|
if (LAST_VALUE != 0):
|
||||||
|
subprocess.run(["shutdown", "/a"])
|
||||||
|
exit
|
||||||
if data is None:
|
if data is None:
|
||||||
time = to_seconds(datetime.strptime(DEFAULT_SHUTDOWN, "%H:%M").time())
|
time = to_seconds(datetime.strptime(DEFAULT_SHUTDOWN, "%H:%M").time())
|
||||||
else:
|
else:
|
||||||
time = to_seconds(datetime.strptime(data["time"], "%H:%M").time())
|
time = to_seconds(datetime.strptime(data["time"], "%H:%M").time())
|
||||||
if data is not None and data["noshutdown"] == 1:
|
|
||||||
exit
|
|
||||||
now = to_seconds(datetime.now().time())
|
now = to_seconds(datetime.now().time())
|
||||||
|
|
||||||
if (time - now) < 0:
|
if (time - now) < 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user