diff options
| author | Christopher Warner <cwarner@kernelcode.com> | 2026-10-13 15:12:17 -0400 |
|---|---|---|
| committer | Christopher Warner <cwarner@kernelcode.com> | 2026-10-13 15:12:17 -0400 |
| commit | 2c8f190bf1e1981813cb04b75b80d46fa79263f5 (patch) | |
| tree | cb18bd0b2fdeac281a63f9f385de34d56eadac51 /bin/install-aerial-videos | |
| parent | 32b692b7712cc6dcb7e17701c55abb4c3a664964 (diff) | |
| download | aerial-screensaver-linux-2c8f190bf1e1981813cb04b75b80d46fa79263f5.tar.gz aerial-screensaver-linux-2c8f190bf1e1981813cb04b75b80d46fa79263f5.tar.bz2 aerial-screensaver-linux-2c8f190bf1e1981813cb04b75b80d46fa79263f5.tar.xz aerial-screensaver-linux-2c8f190bf1e1981813cb04b75b80d46fa79263f5.zip | |
feat: ship video install path for ThinkPad/Intel users
Add install-aerial-videos, LocalSend lite video pack builder, Intel VAAPI
preference, and software x265/x264 encode fallbacks so a T480 can install
clips via zip or Apple fetch without AMD-specific assumptions.
Co-authored-by: Cursor <cursoragent@cursor.com>
Diffstat (limited to 'bin/install-aerial-videos')
| -rwxr-xr-x | bin/install-aerial-videos | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/bin/install-aerial-videos b/bin/install-aerial-videos new file mode 100755 index 0000000..5e6b313 --- /dev/null +++ b/bin/install-aerial-videos @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +# Install Aerial lite clips into ~/Videos/Screensavers/Aerial. +# +# Modes: +# install-aerial-videos # download from Apple + encode +# install-aerial-videos --from-zip FILE.zip # unpack a LocalSend video pack +# install-aerial-videos --from-dir DIR # copy already-lite .mp4 files +set -euo pipefail + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +VIDEO_DIR="${VIDEO_DIR:-$HOME/Videos/Screensavers/Aerial}" +MODE="fetch" +FROM="" + +usage() { + cat <<EOF +Usage: + install-aerial-videos Download recent Apple pack and encode + install-aerial-videos --from-zip ZIP Install from aerial-videos-lite.zip + install-aerial-videos --from-dir DIR Copy .mp4/.mov/.mkv from DIR + +Dest: $VIDEO_DIR +EOF +} + +while [[ $# -gt 0 ]]; do + case "$1" in + --from-zip) + MODE="zip" + FROM="${2:-}" + shift 2 + ;; + --from-dir) + MODE="dir" + FROM="${2:-}" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + echo "Unknown option: $1" >&2 + usage >&2 + exit 1 + ;; + esac +done + +mkdir -p "$VIDEO_DIR" + +case "$MODE" in + zip) + [[ -n "$FROM" && -f "$FROM" ]] || { echo "ZIP not found: $FROM" >&2; exit 1; } + echo "Installing videos from $FROM -> $VIDEO_DIR" + # Accept either flat mp4s or a single top-level folder of mp4s + tmp="$(mktemp -d)" + trap 'rm -rf "$tmp"' EXIT + unzip -q -o "$FROM" -d "$tmp" + mapfile -t files < <(find "$tmp" -type f \( -iname '*.mp4' -o -iname '*.mov' -o -iname '*.mkv' \) | sort) + if [[ ${#files[@]} -eq 0 ]]; then + echo "No videos inside zip" >&2 + exit 1 + fi + for f in "${files[@]}"; do + install -m 0644 "$f" "$VIDEO_DIR/$(basename "$f")" + done + echo "Installed ${#files[@]} clips ($(du -sh "$VIDEO_DIR" | cut -f1))" + ;; + dir) + [[ -n "$FROM" && -d "$FROM" ]] || { echo "DIR not found: $FROM" >&2; exit 1; } + echo "Copying videos from $FROM -> $VIDEO_DIR" + count=0 + while IFS= read -r -d '' f; do + install -m 0644 "$f" "$VIDEO_DIR/$(basename "$f")" + count=$((count + 1)) + done < <(find "$FROM" -maxdepth 1 -type f \( -iname '*.mp4' -o -iname '*.mov' -o -iname '*.mkv' \) -print0 | sort -z) + echo "Installed $count clips ($(du -sh "$VIDEO_DIR" | cut -f1))" + ;; + fetch) + need() { command -v "$1" >/dev/null 2>&1 || { echo "Missing dependency: $1" >&2; exit 1; }; } + need curl + need aria2c + need ffmpeg + FETCH="$ROOT/bin/fetch-aerial-recent" + [[ -x "$FETCH" ]] || FETCH="$(command -v fetch-aerial-recent)" + echo "Fetching + encoding recent Apple Aerial pack (needs network)..." + echo "On a ThinkPad T480 this can take a while; prefer --from-zip if you have the video pack." + DST_DIR="$VIDEO_DIR" "$FETCH" --encode + ;; +esac + +echo "Video dir: $VIDEO_DIR" +ls -lh "$VIDEO_DIR" |
