ASCII-art YouTube streaming for the Tesla in-car browser. - FastAPI server on a Mac mini, no Docker. - yt-dlp resolver: ID/URL/search. - ffmpeg with -re -fps_mode cfr for source-paced video; trivial drain consumer. Separate ffmpeg for AAC/ADTS audio. - Vendored ASCILINE renderer (MIT) for the binary wire protocol; pure fillText color path, on-demand selection flush. - HMAC PIN-gated cookie; Secure flag scheme-aware so /audio works on plain http during local dev. - LOW preset (120x50 24fps) verified clean on M4: FPS 24/24, JIT ~42ms.
56 lines
1.4 KiB
Bash
Executable File
56 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Idempotent setup + launch.
|
|
#
|
|
# ./run.sh # prompts for PIN if ASCIILINE_PIN not set
|
|
# ASCIILINE_PIN=1234 ./run.sh # non-interactive
|
|
# ./run.sh --port 8787 # extra args are passed to server.py
|
|
#
|
|
# Safe to re-run: skips venv creation when .venv already exists.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
echo "Checking ffmpeg..."
|
|
if ! command -v ffmpeg &>/dev/null; then
|
|
echo
|
|
echo "ERROR: ffmpeg not found in PATH."
|
|
echo "Install it with: brew install ffmpeg"
|
|
exit 1
|
|
fi
|
|
echo " ffmpeg: $(ffmpeg -version 2>&1 | head -1)"
|
|
|
|
if [ ! -d ".venv" ]; then
|
|
echo "Creating Python virtual environment..."
|
|
python3 -m venv .venv
|
|
echo " .venv created"
|
|
else
|
|
echo " .venv already exists — skipping creation"
|
|
fi
|
|
|
|
# shellcheck disable=SC1091
|
|
source .venv/bin/activate
|
|
echo " Python: $(python --version)"
|
|
|
|
echo "Installing / verifying Python dependencies..."
|
|
pip install -q -r requirements.txt
|
|
echo " Dependencies OK"
|
|
|
|
if [ -z "${ASCIILINE_PIN:-}" ]; then
|
|
echo
|
|
read -r -s -p "Enter PIN (4-8 digits): " ASCIILINE_PIN
|
|
echo
|
|
if [ -z "$ASCIILINE_PIN" ]; then
|
|
echo "ERROR: PIN is required."
|
|
exit 1
|
|
fi
|
|
fi
|
|
export ASCIILINE_PIN
|
|
|
|
echo
|
|
echo "Starting ASCILINE YouTube Streamer..."
|
|
echo " Press Ctrl-C to stop (ffmpeg processes will be cleaned up automatically)"
|
|
echo
|
|
exec python server.py "$@"
|