#!/usr/bin/env -S npx tsx // The paste, from a terminal. // // Same text the UI's copy buttons put on the clipboard, so a session that is // working on the CLI can read the current picture without a browser and without // the dev server running: // // pnpm exec tsx song/context.mts every song // pnpm exec tsx song/context.mts metal-slug one song // pnpm exec tsx song/context.mts metal-slug wide-short.mp4 42.3 one moment // // With the server up, `curl -s localhost:3050/api/browse/context` is the same // bytes -- this exists for when it is not. import { listSongs } from "../lib/browse.js"; import { allContext, momentCitation, songContext } from "../lib/context.js"; const [song, rel, t] = process.argv.slice(2); if (!song) { const songs = await listSongs(); process.stdout.write(await allContext(songs.map((s) => s.id))); } else if (rel && t !== undefined) { process.stdout.write(await momentCitation(song, rel, Number(t))); } else { process.stdout.write(await songContext(song)); }