Fix logic

This commit is contained in:
Cole Deck 2024-08-06 17:36:31 -05:00
parent 43694ca97d
commit 05baceb388

11
run.py
View File

@ -1121,6 +1121,8 @@ def setup_client(pool):
fprint("Running full jukebox control system...") fprint("Running full jukebox control system...")
jb = subprocess.Popen("ssh root@192.168.1.25 -t -- /root/jukebox-software/run.sh".split(' '), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) jb = subprocess.Popen("ssh root@192.168.1.25 -t -- /root/jukebox-software/run.sh".split(' '), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True)
while True: while True:
if jb.poll() is not None:
break
line = jb.stdout.readline() # Alternatively proc.stdout.read(1024) line = jb.stdout.readline() # Alternatively proc.stdout.read(1024)
if len(line) == 0: # program end if len(line) == 0: # program end
break break
@ -1142,15 +1144,22 @@ def setup_client(pool):
firefox.get('http://192.168.1.25:3000') firefox.get('http://192.168.1.25:3000')
global kill_ssh global kill_ssh
for line in jb.stdout: while True:
if jb.poll() is not None:
break
line = jb.stdout.readline() # Alternatively proc.stdout.read(1024)
if len(line) == 0: # program end
break
print(line, end='') print(line, end='')
if kill_ssh is True: if kill_ssh is True:
break break
firefox.close() firefox.close()
jb.terminate() jb.terminate()
#run_cmd("Stop-VM -Name Jukebox*") #run_cmd("Stop-VM -Name Jukebox*")
sleep(2)
killall() killall()
#firefox.execute_script('document.body.style.MozTransform = "scale(0.80)";') #firefox.execute_script('document.body.style.MozTransform = "scale(0.80)";')