Skip to content

Commit cc2e6a8

Browse files
committed
Now, the Stream NPG button turns green when it actually starts sending data.
1 parent 3bf25b7 commit cc2e6a8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

app.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ def start_lsl():
5151
return render_template("index.html", lsl_started= False, lsl_status= f"Error: {e}", lsl_color= "red")
5252

5353
def read_npg_output():
54-
global npg_process
54+
global npg_process, npg_running
5555

5656
if npg_process:
5757
for line in iter(npg_process.stdout.readline, ''):
58-
print(line.strip()) # Print npg.py output to the terminal
58+
line = line.strip()
59+
if "NPG WebSocket connected!" in line:
60+
npg_running = True
5961

6062
@app.route("/start_npg", methods=["POST"])
6163
def start_npg():
@@ -72,10 +74,7 @@ def start_npg():
7274

7375
# Start a separate thread to read npg.py output
7476
threading.Thread(target=read_npg_output, daemon=True).start()
75-
76-
if "NPG WebSocket connected!" in npg_process.stdout.readline().strip():
77-
npg_running = True
78-
return render_template("index.html", npg_started=True, npg_status="Running", npg_color="green", apps_enabled=True)
77+
return render_template("index.html", npg_started=True, npg_status="Starting...", npg_color="yellow", apps_enabled=False)
7978

8079
except Exception as e:
8180
npg_running = False

0 commit comments

Comments
 (0)