Compare commits
7 Commits
687f156874
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 19009fabcd | |||
|
|
f96941cdca | ||
| 760d43ab8a | |||
| 21ebb41f3f | |||
| 5e219a57f9 | |||
| 134980ad5e | |||
| f0182b9fb7 |
@@ -1,9 +1,12 @@
|
|||||||
:: make the startup script run on startup
|
:: make the startup script run on startup
|
||||||
copy .\startup.cmd "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\"
|
copy .\startup.cmd "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\"
|
||||||
|
|
||||||
:: disable sleep
|
:: disable sleep, DOESN'T WORK MUST BE DONE WITH GUI
|
||||||
powercfg.exe /hibernate off
|
powercfg.exe /hibernate off
|
||||||
|
|
||||||
|
:: disable recovery mode
|
||||||
|
Reagentc /disable
|
||||||
|
|
||||||
:: disable updates
|
:: disable updates
|
||||||
sc config wuauserv start= disabled
|
sc config wuauserv start= disabled
|
||||||
sc stop wuauserv
|
sc stop wuauserv
|
||||||
|
|||||||
5
pull.cmd
Normal file
5
pull.cmd
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
:: Pull from git and reconfigure
|
||||||
|
git pull
|
||||||
|
config
|
||||||
|
cd 'C:\Users\LattePanda\Documents\Max 8\Library\healing-soundscapes\'
|
||||||
|
git pull
|
||||||
@@ -1,2 +1,6 @@
|
|||||||
:: Connect to the local network
|
:: Connect to the local network
|
||||||
netsh wlan connect ssid="hsspeakers" name="hsspeakers"
|
netsh wlan connect ssid="hsspeakers" name="hsspeakers"
|
||||||
|
|
||||||
|
:: Run max client patch
|
||||||
|
cd C:\Users\LattePanda\Documents\Max 8\Library\healing-soundscapes\
|
||||||
|
hss-distributed-client.maxpat
|
||||||
23
websockets/check_system_status.py
Normal file
23
websockets/check_system_status.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import asyncio
|
||||||
|
|
||||||
|
from websockets.asyncio.client import connect
|
||||||
|
import websockets
|
||||||
|
|
||||||
|
async def init():
|
||||||
|
uri = "ws://192.168.6.101:3003"
|
||||||
|
async with connect(uri) as websocket:
|
||||||
|
await websocket.send("status")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
msg = await websocket.recv()
|
||||||
|
print(msg)
|
||||||
|
except websockets.ConnectionClosed:
|
||||||
|
print(f"Terminated by server")
|
||||||
|
break
|
||||||
|
except asyncio.exceptions.CancelledError:
|
||||||
|
print("Closed by user")
|
||||||
|
break
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(init())
|
||||||
46
websockets/server.py
Normal file
46
websockets/server.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import asyncio
|
||||||
|
from websockets.asyncio.server import serve
|
||||||
|
import websockets as ws
|
||||||
|
import time
|
||||||
|
|
||||||
|
class SpeakerClient:
|
||||||
|
def __init__(self, connection, instance) -> None:
|
||||||
|
self.connection = connection
|
||||||
|
self.instance = instance
|
||||||
|
self.alive = True
|
||||||
|
|
||||||
|
async def check_open(self):
|
||||||
|
try:
|
||||||
|
await self.connection.send("")
|
||||||
|
return True
|
||||||
|
except ws.ConnectionClosed:
|
||||||
|
return False
|
||||||
|
|
||||||
|
CONNECTIONS = set()
|
||||||
|
|
||||||
|
|
||||||
|
async def handler(websocket):
|
||||||
|
async for message in websocket:
|
||||||
|
args = message.split('/')
|
||||||
|
if (args[0] == "speaker"):
|
||||||
|
CONNECTIONS.add(SpeakerClient(websocket, int(args[1])))
|
||||||
|
print(f"New Speaker, instance {args[1]}")
|
||||||
|
if (args[0] == "status"):
|
||||||
|
print("Checking system health...")
|
||||||
|
remove_conns = []
|
||||||
|
for c in CONNECTIONS:
|
||||||
|
status = await c.check_open()
|
||||||
|
if status:
|
||||||
|
print(f"Instance {c.instance} is alive")
|
||||||
|
await websocket.send(f"Instance {c.instance} is alive")
|
||||||
|
else:
|
||||||
|
remove_conns.append(c)
|
||||||
|
for c in remove_conns:
|
||||||
|
CONNECTIONS.remove(c)
|
||||||
|
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
async with serve(handler, "", 3003):
|
||||||
|
await asyncio.get_running_loop().create_future() # run forever
|
||||||
|
|
||||||
|
asyncio.run(main())
|
||||||
20
websockets/speaker_client.py
Normal file
20
websockets/speaker_client.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import asyncio
|
||||||
|
|
||||||
|
from websockets.asyncio.client import connect
|
||||||
|
import websockets
|
||||||
|
|
||||||
|
async def init():
|
||||||
|
uri = "ws://192.168.6.101:3003"
|
||||||
|
async with connect(uri) as websocket:
|
||||||
|
await websocket.send("speaker/2")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
await websocket.recv()
|
||||||
|
except websockets.ConnectionClosed:
|
||||||
|
print(f"Terminated by server")
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(init())
|
||||||
Reference in New Issue
Block a user