Skip to content

Commit

Permalink
fix: missing delayed halt function
Browse files Browse the repository at this point in the history
  • Loading branch information
vicwomg committed Jan 5, 2025
1 parent d529a09 commit aa23538
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions pikaraoke/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@
linux = get_platform() == "linux"


def delayed_halt(cmd):
time.sleep(1.5)
k.queue_clear()
cherrypy.engine.stop()
cherrypy.engine.exit()
k.stop()
if cmd == 0:
sys.exit()
if cmd == 1:
os.system("shutdown now")
if cmd == 2:
os.system("reboot")
if cmd == 3:
process = subprocess.Popen(["raspi-config", "--expand-rootfs"])
process.wait()
os.system("reboot")


def is_admin():
if admin_password == None:
return True
Expand Down Expand Up @@ -676,24 +694,6 @@ def refresh():

@app.route("/quit")
def quit():
# Delay system commands to allow redirect to render first
def delayed_halt(cmd):
time.sleep(1.5)
k.queue_clear()
cherrypy.engine.stop()
cherrypy.engine.exit()
k.stop()
if cmd == 0:
sys.exit()
if cmd == 1:
os.system("shutdown now")
if cmd == 2:
os.system("reboot")
if cmd == 3:
process = subprocess.Popen(["raspi-config", "--expand-rootfs"])
process.wait()
os.system("reboot")

if is_admin():
# MSG: Message shown after quitting pikaraoke.
msg = _("Exiting pikaraoke now!")
Expand Down

0 comments on commit aa23538

Please sign in to comment.