Implement synchronized LED wall output

This commit is contained in:
TJY
2026-07-16 12:52:42 +08:00
parent 8590fafac1
commit fe906e028b
11 changed files with 335 additions and 283 deletions
+13 -1
View File
@@ -1,4 +1,5 @@
import webbrowser
import socket
import typer
import uvicorn
@@ -8,6 +9,16 @@ from led_platform.core.config import get_settings
app = typer.Typer(help="LED wall projection platform CLI.")
def _lan_base_url(port: int = 8000) -> str:
try:
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
sock.connect(("8.8.8.8", 80))
host = sock.getsockname()[0]
except OSError:
host = "127.0.0.1"
return f"http://{host}:{port}"
@app.command()
def serve(
host: str = typer.Option(None, help="Bind host."),
@@ -25,8 +36,9 @@ def serve(
@app.command()
def urls(
base: str = typer.Option("http://127.0.0.1:8000", help="Controller base URL."),
base: str = typer.Option(None, help="Controller base URL."),
) -> None:
base = base or _lan_base_url()
typer.echo(f"Admin: {base}/")
typer.echo(f"Left output: {base}/output/left")
typer.echo(f"Right output:{base}/output/right")