adding process kill cases, to prevent guru from playing at the same time as announcements.py

master
acastro 5 years ago
parent 7b3206bde5
commit b42f6687f7

@ -6,6 +6,19 @@ from LEDfunctions import *
# this script plays the content of the announcer (from json file)
import subprocess
# is the guru running?
try:
pirate_pid = subprocess.check_output(
["pgrep", "-f", "guru-pirate.py"]
)
print("guru pirate running:",pirate_pid)
subprocess.call(["kill", pirate_pid.replace("\n","")])
except:
print("guru-pirate is not running")
sleep(4)
# when characters speak the LEDs light up and perform effects
def vu_2_leds(color):
while True:

@ -7,7 +7,20 @@ import json, random, os, subprocess
from pprint import pprint
from time import sleep
from LEDfunctions import *
import sys
import subprocess
# is the announcements.py running?
try: # try: if no error - the process is running.
# therefore exit()
ann_pid = subprocess.check_output(["pgrep", "-f", "announcements.py"])
print("announcements.py ARE running. Will stop here", ann_pid)
except:
print("announcements.py are not running. Will run guru")
if 'ann_pid' in vars() or 'ann_pid' in globals():
sys.exit(1)
# when characters speak the LEDs light up and perform effects
def vu_2_leds(color):

Loading…
Cancel
Save