feat(websocket): add WebSocket display backend for browser client
This commit is contained in:
@@ -29,6 +29,18 @@ from engine.terminal import (
|
||||
slow_print,
|
||||
tw,
|
||||
)
|
||||
from engine.websocket_display import WebSocketDisplay
|
||||
|
||||
|
||||
def _get_display():
|
||||
"""Get the appropriate display based on config."""
|
||||
if config.WEBSOCKET:
|
||||
ws = WebSocketDisplay(host="0.0.0.0", port=config.WEBSOCKET_PORT)
|
||||
ws.start_server()
|
||||
ws.start_http_server()
|
||||
return ws
|
||||
return None
|
||||
|
||||
|
||||
TITLE = [
|
||||
" ███╗ ███╗ █████╗ ██╗███╗ ██╗██╗ ██╗███╗ ██╗███████╗",
|
||||
@@ -343,7 +355,10 @@ def main():
|
||||
print()
|
||||
time.sleep(0.4)
|
||||
|
||||
stream(items, ntfy, mic)
|
||||
display = _get_display()
|
||||
stream(items, ntfy, mic, display)
|
||||
if display:
|
||||
display.cleanup()
|
||||
|
||||
print()
|
||||
print(f" {W_GHOST}{'─' * (tw() - 4)}{RST}")
|
||||
|
||||
Reference in New Issue
Block a user