From a0be6bfcac07a256949082e935e1be06753ab872 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 15 Oct 2026 10:17:29 +0200 Subject: feat(cli): stream — a film or a song played in a media player MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `meshbay-cli stream PATH` serves one video or sound file over HTTP on 127.0.0.1 for VLC, mpv or any player that reads HTTP; `--player PROGRAM` starts the player, and closing it stops the stream, as Ctrl+C does. The file goes as the node stores it: no remux, no transcode, no stream slot on the node. Byte ranges are answered from leaseless file_req chunks decrypted in memory, eight ahead and the last 24 kept. Loopback only, a random token in the address, a foreign Host refused (DNS rebinding), an audio or video type with nosniff. The connection is pinged and reopened when it dies; a refusal by the node stops the stream (exit 5). Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-cli/src/meshbay_cli/__main__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'packages/meshbay-cli/src/meshbay_cli/__main__.py') diff --git a/packages/meshbay-cli/src/meshbay_cli/__main__.py b/packages/meshbay-cli/src/meshbay_cli/__main__.py index 2a71c17..f5b002a 100644 --- a/packages/meshbay-cli/src/meshbay_cli/__main__.py +++ b/packages/meshbay-cli/src/meshbay_cli/__main__.py @@ -28,6 +28,7 @@ from .commands import ( put, rm, search, + stream, trust, ) from .commands.context import Context @@ -35,8 +36,8 @@ from .errors import INTERRUPTED, USAGE, CliError ACTIONS = {"login": login, "logout": logout, "groups": groups, "invitations": invitations, "join": join, "decline": decline, "leave": leave, "ls": ls, "search": search, "get": get, - "put": put, "rm": rm, "chat": chat, "devices": devices, "trust": trust, - "browser-access": browser_access, "help": help} + "stream": stream, "put": put, "rm": rm, "chat": chat, "devices": devices, + "trust": trust, "browser-access": browser_access, "help": help} class _Parser(argparse.ArgumentParser): @@ -142,8 +143,8 @@ def main(argv: list[str] | None = None) -> int: def _utf8_output() -> None: """Names are printed as they are; a Windows console's code page cannot hold most.""" - for stream in (sys.stdout, sys.stderr): - reconfigure = getattr(stream, "reconfigure", None) + for out in (sys.stdout, sys.stderr): + reconfigure = getattr(out, "reconfigure", None) if reconfigure is not None: try: reconfigure(encoding="utf-8", errors="replace") -- cgit v1.2.3