Add lab restream pipeline with pirate_drift logo and lib/env.sh.

Encode-once/fanout scripts, HLS output, and single overloadable env source.
Commits assets/pirate_drift.png as default watermark for cluster runs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-07-11 15:27:24 +02:00
parent d990862b64
commit 5ca8a9f539
27 changed files with 911 additions and 1 deletions

50
bin/switch-source.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Stop pipeline, optionally rotate source index, restart (v0 switch_quality.sh cleanup).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck disable=SC1091
source "${ROOT}/lib/common.sh"
VARIANT="${1:-}"
SRC="${SRC:-}"
if [[ "${VARIANT}" == "stop" ]]; then
exec "${ROOT}/bin/stop.sh"
fi
case "${VARIANT}" in
blur|blurred) export FILTER_PROFILE=blurred ;;
nologo) export FILTER_PROFILE=nologo ;;
default|'') export FILTER_PROFILE=default ;;
encode-only|record)
export RUN_ENCODE_ONLY=1
;;
[0-9]*)
SRC="${VARIANT}"
;;
esac
if [[ -z "${SRC}" && -f "${ROOT}/.current_source" ]]; then
# rotate index in sources.list
if [[ -f "${SOURCES_LIST}" ]]; then
count="$(grep -vc '^[[:space:]]*#' "${SOURCES_LIST}" || true)"
cur=1
[[ -f "${ROOT}/.current_index" ]] && cur="$(cat "${ROOT}/.current_index")"
cur=$((cur + 1))
[[ "${count}" -gt 0 && "${cur}" -gt "${count}" ]] && cur=1
echo "${cur}" > "${ROOT}/.current_index"
SRC="${cur}"
fi
fi
SRC="${SRC:-1}"
"${ROOT}/bin/stop.sh"
sleep 1
log "switch → source index ${SRC} profile ${FILTER_PROFILE}"
if [[ -n "${RUN_ENCODE_ONLY:-}" || "${VARIANT}" == "encode-only" || "${VARIANT}" == "record" ]]; then
exec "${ROOT}/bin/run-encode-only.sh" "${SRC}"
fi
exec "${ROOT}/bin/run.sh" "${SRC}"