#!/bin/bash # Keep yt-dlp current inside ytstream's venv, then confirm the install still works. # # This is the single most important recurring job: YouTube changes its player and # streaming protocol frequently, and a stale yt-dlp means every playback fails. set -euo pipefail VENV=/var/lib/ytstream/venv before=$("$VENV/bin/yt-dlp" --version 2>/dev/null || echo "none") "$VENV/bin/pip" install --quiet --upgrade "yt-dlp[default]" after=$("$VENV/bin/yt-dlp" --version) echo "yt-dlp: $before -> $after" if [[ "$before" != "$after" ]]; then # A new yt-dlp can change format availability, so restart the proxy to drop # any cached extraction state and re-run the checks. systemctl restart ytstream-proxy.service 2>/dev/null \ || echo "could not restart the proxy (needs root); do it by hand" fi exec "$VENV/bin/ytstream" doctor