feat(stream): video libraries, directory linking, uploads, and video management - #203
feat(stream): video libraries, directory linking, uploads, and video management#203amir-at-bunny wants to merge 5 commits into
Conversation
|
…face Stream error messages Verbose debug logging read every request body as JSON, which would buffer an entire video into memory on octet-stream uploads; non-JSON bodies are now described from their headers instead. Error extraction also learns the Stream API's StatusModel shape (lowercase message), so 400/422/429 responses carry the API's explanation instead of a generic HTTP error.
…management New experimental stream namespace: - stream library: list, create, show, credentials, delete (aliases: libraries, lib) - stream link / unlink: bind a directory to a library via .bunny/stream.json - stream upload: local file via binary PUT, or a URL fetched server side (--header for authenticated origins); library from --lib <id>, the linked directory, or an interactive picker - stream videos: list, show, update, delete by GUID Library CRUD runs on the core API with the account key; uploads and video commands use the library's own Stream API key, resolved automatically. No output format prints API keys (credentials --show-secret is the deliberate reveal path); JSON output strips ApiKey, ReadOnlyApiKey, and the deprecated ApiAccessKey.
…ctions, and captions Restructure: the video group is canonical (videos stays an alias), upload splits into video upload (local files) and video fetch (server-side URL fetch with --header/--collection/--thumbnail-time), and link/unlink move under library. library update: new command for library settings, sharing the encoding and transcribing flags with create (--encoding-tier, --jit, --codecs, --resolutions, --transcribing and its language/generation options); sparse bodies send only the flagged fields, and a no-flag TTY run opens an interactive editor. New video verbs: thumbnail (--url or --file), resolutions, cleanup (full selector surface, confirmed, --dry-run), stats (--heatmap/--play-data), and update gains --collection/--chapters/--moments. New namespaces: collection (create/list/show/rename/delete) and caption (add with the API's validation surfaced, delete). Paid operations: encode enable/reencode, transcribe, and smart, each printing its billing note; smart confirms before implicitly transcribing a caption-less video. Uploads over 2 GiB switch to TUS resumable uploads automatically: 64 MiB chunks, every request signed, offsets driven by the server, and resume via HEAD after transient failures. openapi-client: verbose debug logging redacts secret-shaped fields (keys, passwords, tokens, authorization headers) from request and response body dumps. Hardening from review: pagination drains tolerate absent or misreported totalItems, --force disables pickers on paid commands too, collection show requests the preview URLs it documents, and video show reports captions.
1d2704d to
65772e2
Compare
| } | ||
|
|
||
| export const streamSmartCommand = defineCommand<SmartArgs>({ | ||
| command: "smart [video]", |
There was a problem hiding this comment.
| command: "smart [video]", | |
| command: "transcribe [video]", |
Maybe worth calling this transcribe like we do elsewhere on site?
There was a problem hiding this comment.
this is not for transcribe though - that already has its own command. this is to generate smart chapters, etc.
the doc we got mentions this command but i do think a better name is needed.
Live testing showed the Stream API cascade-deletes a collection's videos; the confirmation, output, JSON shape (videosDeleted), and docs said the opposite. The prompt now names the video count, and the docs explain that clearing a video's collection first is the way to keep it.
…ing a phantom charge Live testing showed the smart endpoint refuses captionless videos even when the library has transcribing enabled; it never auto-transcribes. The confirmation gate promised a transcription charge that cannot happen and then failed anyway. A captionless video now errors up front with a pointer to stream transcribe / caption add, and smart's --force is picker-only.
A new experimental
streamnamespace for managing bunny.net Stream, plus a smallopenapi-clientfix (verbose logging skips binary request bodies, redacts secret-shaped fields, and surfaces Stream API error messages).Commands
bunny stream library(aliaseslibraries,lib)list,create,show,update,deletecredentials: retrieve a library's Stream API keys (masked unless--show-secret)link/unlink: bind the current directory to a library via.bunny/stream.jsonso other stream commands can omit--libcreate/updatecarry the encoding and transcribing settings:--encoding-tier,--jit,--codecs,--resolutions,--transcribing,--transcribing-languages, and the generation togglesbunny stream video(aliasvideos)upload <file>: create-and-upload in one command; files over 2 GiB upload resumably via TUSfetch <url>: server-side fetch of a remote video, with--headerfor authenticated originslist(--search,--collection),show,update(--title,--collection,--chapters,--moments),deletethumbnail(--urlor--file),resolutions,cleanup,stats(--heatmap,--play-data)uploadandfetchaccept--collectionand--thumbnail-timebunny stream collection(aliascollections)create,list,show,rename,deletebunny stream caption(aliascaptions)add <video> <lang> --file(.vtt/.srt),delete <video> <lang>Paid operations
bunny stream encode enable/encode reencodebunny stream transcribe <video>(--languages,--source-language,--generate-*,--force)bunny stream smart <video>(--title,--description,--chapters,--moments)All commands support
--output json|csv|markdown, resolve the library from--lib <id>, the linked directory, or an interactive picker, and take--forceto skip confirmations non-interactively.