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/manpage.py | 40 ++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'packages/meshbay-cli/src/meshbay_cli/manpage.py') diff --git a/packages/meshbay-cli/src/meshbay_cli/manpage.py b/packages/meshbay-cli/src/meshbay_cli/manpage.py index 601bd5b..c4710f3 100644 --- a/packages/meshbay-cli/src/meshbay_cli/manpage.py +++ b/packages/meshbay-cli/src/meshbay_cli/manpage.py @@ -28,7 +28,7 @@ EXIT_CODES = { errors.NODE: "No node serving the group could be reached, or the node refused " "the connection. Also: this machine is waiting for device " "approval (the code is on stderr), or the node asks for an " - "invitation's code.", + "invitation's code. Also: the node refused a file being streamed.", errors.NODE_KEY: "A node presented another key than the one pinned at first " "contact. Nothing was sent. See \\fBtrust\\fR.", errors.VERSION: "This client, or the protocol it speaks, is too old or too new " @@ -38,15 +38,16 @@ EXIT_CODES = { "group you own, revoking this machine, deleting a file you may not " "delete.", errors.INTERRUPTED: "Interrupted (Ctrl+C), which is also how chat \\-\\-follow " - "ends. A download resumes where it stopped on the next run.", + "and stream end. A download resumes where it stopped on the " + "next run.", } DESCRIPTION = r""" .B meshbay-cli is a member's view of their MeshBay groups from a terminal: sign in, join and leave groups, list them and their folders, search them all at once, download, -upload and delete files, read and post in a group's chat, and approve this -account's other devices. +upload and delete files, play a film or a song in a media player, read and +post in a group's chat, and approve this account's other devices. It talks to the hub only to sign in and to find a group's nodes; files go directly between this machine and the node, end-to-end encrypted, never through the hub. @@ -277,6 +278,34 @@ It is this machine's setting, as Browser access is the desktop application's: the hub keeps a copy for browsers to read, and that copy never turns it on here. """ +STREAMING = r""" +.B stream +plays one video or sound file of a group in a media player that reads HTTP, +such as VLC or mpv. +The file is served on this machine at an address printed on stdout, as it is +on the node: the player decodes it, so every format the player knows plays, +subtitles held in the file included. +Seeking is the player's: it asks for another part of the file, fetched from the +node then. +Nothing is written to disk. +.PP +The address works only on this machine (127.0.0.1) and only while +.B stream +runs; it carries a random part, so another program or another account of this +machine cannot guess it, and a request naming another host, as a web page +would send, is refused. +.B \-\-player +\fIPROGRAM\fR starts the player on the address (on Windows, VLC is looked for +where it installs itself too); closing it stops the stream. +Ctrl+C stops it too (status 130), and closes the player +.B stream +started. +A connection to the node that drops or stops answering is opened again; the +player sees a slower read. +If the node refuses the file, because it was removed or its disk went away, +the stream stops (status 5). +""" + FILES = r""" .TP .I $XDG_DATA_HOME/meshbay\-cli/ \fR(default \fI~/.local/share/meshbay\-cli/\fR) @@ -336,6 +365,8 @@ meshbay\-cli groups meshbay\-cli ls \-l Family/photos/2024 meshbay\-cli get \-R Family/photos/2024 \-o ~/Pictures/ meshbay\-cli get 'Family/music/*.flac' +meshbay\-cli stream \-\-player vlc 'Family/films/Night Drive.mkv' +meshbay\-cli stream \-\-player mpv "$(meshbay\-cli search \-t audio nocturne | head \-1)" meshbay\-cli put \-R ~/scans Family/documents tar c notes | meshbay\-cli put \- Family/documents/notes.tar meshbay\-cli ls \-\-json \-R / | jq '.[] | .path' @@ -444,6 +475,7 @@ def render() -> str: out += [".SH REMOTE PATHS", PATHS.strip(), ".SH INTERACTIVE MODE", INTERACTIVE.strip(), ".SH SESSION, DEVICES AND NODE KEYS", SESSION.strip(), + ".SH STREAMING", STREAMING.strip(), ".SH GROUPS: JOINING, LEAVING, DELETING, CHAT, DEVICES", MEMBERSHIP.strip(), ".SH EXIT STATUS"] for code, text in sorted(EXIT_CODES.items()): -- cgit v1.2.3