#!/usr/bin/env bash # Event recap: photos from an event become a vertical recap with a headline, # the date and venue, your logo, sponsor logos shown together at the end, and # a music bed. A 50-second recap is 75 credits; the Preview is free. # The calls of the page https://api.oneupai.com/docs/recipes/event-recap, in # its order, as one program (the photo-reel Timeline of the listing reel, with # the page's headline and sponsor wall). # # In the folder you run it from: the photos as photo-1.jpg, photo-2.jpg, … (in # the order they should play; up to 40), your logo as logo.png, each sponsor's # logo as sponsor-1.png, sponsor-2.png, … and the music as music.mp3. Change # HEADLINE and WHEN below. # # export ONEUP_API_KEY="oneup_live_…" # your Builder key # bash run.sh # # Needs curl, jq and uuidgen. ONEUP_BASE_URL changes the host (default # https://api.oneupai.com). Every answer is printed as it arrives. set -euo pipefail : "${ONEUP_API_KEY:?Set ONEUP_API_KEY to your API key first}" API=${ONEUP_BASE_URL:-https://api.oneupai.com} HEADLINE="Oakridge Founders Summit 2026" WHEN="Sept 12, 2026 · The Granary, Oakridge" # One API call; the answer is printed and kept in OUT. A refusal stops here. api() { local method=$1 path=$2 shift 2 OUT=$(curl -sS -X "$method" "$API$path" \ -H "Authorization: Bearer $ONEUP_API_KEY" \ -H "Content-Type: application/json" "$@") echo "$OUT" if ! echo "$OUT" | jq -e 'type == "object" and (has("error") | not)' > /dev/null; then echo "refused: $method $path" >&2 exit 1 fi } # Uploads one file; its upload id is left in UPLOAD. upload() { local file=$1 type=$2 size size=$(wc -c < "$file" | tr -d ' ') api POST /v1/uploads/initiate -d "$(jq -n --arg t "$type" --arg n "$file" --argjson s "$size" \ '{content_type: $t, file_name: $n, size_bytes: $s}')" UPLOAD=$(echo "$OUT" | jq -r .upload_id) curl -sS -f -X PUT "$(echo "$OUT" | jq -r .upload_url)" \ -H "Content-Type: $type" --data-binary @"$file" > /dev/null } # Starts a render, waits for it, and leaves the finished render in OUT. render() { api POST /v1/renders -H "Idempotency-Key: $(uuidgen)" \ -d "$(jq -n --arg p "$PROJECT" --arg v "$VERSION" --arg k "$1" \ '{alias: "oneup/render-timeline", project_id: $p, version_id: $v, kind: $k}')" local id id=$(echo "$OUT" | jq -r .render_id) until echo "$OUT" | jq -e '.status == "COMPLETED" or .status == "FAILED"' > /dev/null; do sleep 5 api GET "/v1/renders/$id" done } ls photo-*.jpg > /dev/null 2>&1 || { echo "no photo-*.jpg in this folder" >&2; exit 1; } PHOTOS='[]' for file in $(printf '%s\n' photo-*.jpg | sort -t- -k2 -n); do upload "$file" image/jpeg PHOTOS=$(echo "$PHOTOS" | jq -c --arg id "$UPLOAD" '. + [$id]') done upload logo.png image/png LOGO=$UPLOAD SPONSORS='[]' for file in $(printf '%s\n' sponsor-*.png | sort -t- -k2 -n); do [ -e "$file" ] || continue upload "$file" image/png SPONSORS=$(echo "$SPONSORS" | jq -c --arg id "$UPLOAD" '. + [$id]') done upload music.mp3 audio/mpeg MUSIC=$UPLOAD api POST /v1/projects -d '{"agent_slug": "oneup/render-timeline"}' PROJECT=$(echo "$OUT" | jq -r .project_id) # Each photo is 3 s, joined by 0.4 s crossfades; the closing card is 4 s and # carries the sponsor wall. The recap's length is the durations added up, # minus each crossfade. TIMELINE=$(jq -n --argjson photos "$PHOTOS" --arg logo "$LOGO" --arg music "$MUSIC" \ --arg headline "$HEADLINE" --arg when "$WHEN" --argjson sponsors "$SPONSORS" ' ($photos | length) as $n | ($n * 3000 + 4000 - $n * 400) as $total | { v: "1.1", output: {aspect: "9:16", resolution: 1080, fps: 30, container: "mp4"}, segments: ([$photos | to_entries[] | { id: "p\(.key + 1)", source: {"$asset": .value}, duration: 3000, effects: [if .key % 2 == 0 then {op: "kenburns", from: {x: 0.5, y: 0.5, zoom: 1}, to: {x: 0.5, y: 0.5, zoom: 1.18}, ease: "ease_in_out"} else {op: "kenburns", from: {x: 0.58, y: 0.5, zoom: 1.18}, to: {x: 0.42, y: 0.5, zoom: 1.18}, ease: "ease_in_out"} end], transition_out: {op: "crossfade", duration: 400} }] + [{id: "card", source: {"$asset": $photos[-1]}, duration: 4000, effects: [{op: "fade", from: 1, to: 0, duration: 600}]}]), overlays: ([ {id: "logo", kind: "image", source: {"$asset": $logo}, position: {x: 0.05, y: 0.028}, scale: 0.12, range: {from: 0, to: $total}}, {id: "t1", kind: "text", content: $headline, style: "headline", position: "middle", range: {from: 0, to: 4000}}, {id: "t2", kind: "text", content: $when, style: "lower_third", position: "bottom", range: {from: 0, to: 4000}} ] + [$sponsors | to_entries[] | { id: "sp\(.key + 1)", kind: "image", source: {"$asset": .value}, position: {x: (0.1 + (.key % 3) * 0.3), y: (0.7 + ((.key / 3) | floor) * 0.12)}, scale: 0.2, range: {from: ($total - 4000), to: $total} }]), audio: [{id: "bed", role: "music", source: {"$asset": $music}, range: {from: 0, to: $total}, loop: true, gain: -14, fade_in: 600, fade_out: 600}] }') api PUT "/v1/projects/$PROJECT/timeline" -d "$(jq -n --argjson t "$TIMELINE" '{timeline: $t}')" VERSION=$(echo "$OUT" | jq -r .version_id) render preview render final api GET "/v1/queue/result/$(echo "$OUT" | jq -r .ticket)"