Skip to content

Commit

Permalink
Check if dropbox games folder integration exists
Browse files Browse the repository at this point in the history
In case Drupebox (dropbox folder sychnronization) has been installed the sync process is called when shutting down/exiting or rebooting picochess
  • Loading branch information
tosca07 authored May 20, 2024
1 parent 7b86218 commit 818f53b
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from typing import Optional

# picochess version
version = '3.3'
version = '3.2'

evt_queue: queue.Queue = queue.Queue()
dispatch_queue: queue.Queue = queue.Queue()
Expand Down Expand Up @@ -237,7 +237,13 @@ def update_picochess(dgtpi: bool, auto_reboot: bool, dgttranslate: DgtTranslate)
def shutdown(dgtpi: bool, dev: str):
"""Shutdown picochess."""
logging.debug('shutting down system requested by (%s)', dev)
time.sleep(5) # give some time to send out the pgn file or speak the event

try:
subprocess.run(['python3', 'home/pi/drupebox/drupebox.py'])
except FileNotFoundError:
pass

time.sleep(10) # give some time to send out the pgn file or speak the event
if platform.system() == 'Windows':
os.system('shutdown /s')
elif dgtpi:
Expand All @@ -251,7 +257,12 @@ def shutdown(dgtpi: bool, dev: str):
def exit(dgtpi: bool, dev: str):
"""exit picochess."""
logging.debug('exit picochess requested by (%s)', dev)
time.sleep(5) # give some time to send out the pgn file or speak the event
try:
subprocess.run(['python3', '/home/pi/drupebox/drupebox.py'])
except FileNotFoundError:
pass

time.sleep(10) # give some time to send out the pgn file or speak the event
if platform.system() == 'Windows':
os.system('sudo pkill -f chromium')
os.system('sudo systemctl stop picochess')
Expand All @@ -270,7 +281,11 @@ def exit(dgtpi: bool, dev: str):
def reboot(dgtpi: bool, dev: str):
"""Reboot picochess."""
logging.debug('rebooting system requested by (%s)', dev)
time.sleep(5) # give some time to send out the pgn file or speak the event
try:
subprocess.run(['python3', '/home/pi/drupebox/drupebox.py'])
except FileNotFoundError:
pass
time.sleep(10) # give some time to send out the pgn file or speak the event
if platform.system() == 'Windows':
os.system('shutdown /r')
elif dgtpi:
Expand Down

0 comments on commit 818f53b

Please sign in to comment.