Download: Add script flags to install "yt-dlp" nightly and master builds

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2026-01-28 11:10:12 +01:00
parent 68c1b35801
commit 8400dda02b
3 changed files with 85 additions and 5 deletions

View file

@ -1,6 +1,6 @@
## PhotoPrism — Download Helpers
**Last Updated:** November 22, 2025
**Last Updated:** January 28, 2026
### Overview
@ -50,4 +50,6 @@ It currently supports two invocation methods:
- Prefer the file method for sources with separate audio/video streams; the pipe method cannot always merge in that case.
- When the CLIs `--file-remux=auto` is used, the final ffmpeg remux is skipped for MP4 outputs that already include metadata.
- Keep `yt-dlp` updated. Releases older than `2025.09.23` are known to miss YouTube video formats (SABR gating); the CLI now logs a warning when it detects an outdated build.
- If a YouTube change breaks stable releases, you can install the latest nightly build using `scripts/dist/install-yt-dlp.sh --nightly` (or set `PHOTOPRISM_YTDLP_CHANNEL=nightly` before running the script).
- If you need the master build, use `scripts/dist/install-yt-dlp.sh --master` (or set `PHOTOPRISM_YTDLP_CHANNEL=master` before running the script).
- Users who favor one approach can set `PHOTOPRISM_DL_METHOD=file` (or `pipe`) in the environment to change the default without touching CLI flags.

View file

@ -69,6 +69,12 @@ darktable:
yt-dlp: update-yt-dlp
update-yt-dlp:
sudo yt-dlp -U
yt-dlp-nightly: install-yt-dlp-nightly
install-yt-dlp-nightly:
@/scripts/install-yt-dlp.sh --nightly
yt-dlp-master: install-yt-dlp-master
install-yt-dlp-master:
@/scripts/install-yt-dlp.sh --master
# Declare all targets as "PHONY", see https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html.
MAKEFLAGS += --always-make

View file

@ -1,7 +1,9 @@
#!/usr/bin/env bash
# Installs the yt-dlp binary, a vector search engine, on Linux.
# Installs the yt-dlp binary (stable, nightly, or master) on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-yt-dlp.sh)
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-yt-dlp.sh) -- --nightly
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-yt-dlp.sh) -- --master
set -euo pipefail
@ -12,10 +14,63 @@ fi
# Show usage information if first argument is --help.
if [[ ${1:-} == "--help" ]]; then
echo "Usage: ${0##*/} [destdir] [version]" 1>&2
echo "Usage: ${0##*/} [--nightly|--master|--stable] [destdir] [version]" 1>&2
echo " ${0##*/} [--channel nightly|master|stable] [destdir] [version]" 1>&2
echo "" 1>&2
echo "Environment:" 1>&2
echo " PHOTOPRISM_YTDLP_CHANNEL=nightly|master|stable" 1>&2
exit 0
fi
CHANNEL=${PHOTOPRISM_YTDLP_CHANNEL:-stable}
while [[ $# -gt 0 ]]; do
case $1 in
--nightly)
CHANNEL=nightly
shift
;;
--master)
CHANNEL=master
shift
;;
--stable)
CHANNEL=stable
shift
;;
--channel)
CHANNEL=${2:-}
if [[ -z $CHANNEL ]]; then
echo "Error: --channel requires a value (nightly, master, or stable)." 1>&2
exit 1
fi
shift 2
;;
--help)
echo "Usage: ${0##*/} [--nightly|--master|--stable] [destdir] [version]" 1>&2
echo " ${0##*/} [--channel nightly|master|stable] [destdir] [version]" 1>&2
echo "" 1>&2
echo "Environment:" 1>&2
echo " PHOTOPRISM_YTDLP_CHANNEL=nightly|master|stable" 1>&2
exit 0
;;
--)
shift
break
;;
-*)
echo "Error: Unknown option: $1" 1>&2
exit 1
;;
*)
break
;;
esac
done
# Normalize channel to lowercase to avoid case-sensitivity surprises.
CHANNEL=${CHANNEL,,}
# You can provide a custom installation directory as the first argument.
DESTDIR=$(realpath "${1:-/usr/local}")
@ -75,11 +130,27 @@ case $DESTARCH in
;;
esac
DEFAULT_RELEASES_URL="https://api.github.com/repos/yt-dlp/yt-dlp/releases?per_page=5"
case $CHANNEL in
nightly)
REPO="yt-dlp/yt-dlp-nightly-builds"
;;
master)
REPO="yt-dlp/yt-dlp-master-builds"
;;
stable)
REPO="yt-dlp/yt-dlp"
;;
*)
echo "Error: Unknown channel \"$CHANNEL\" (use nightly, master, or stable)." 1>&2
exit 1
;;
esac
DEFAULT_RELEASES_URL="https://api.github.com/repos/${REPO}/releases?per_page=5"
if [[ -n ${2:-} ]]; then
VERSION=${2}
RELEASES_JSON=$(curl --fail --silent --show-error "https://api.github.com/repos/yt-dlp/yt-dlp/releases/tags/${VERSION}" || true)
RELEASES_JSON=$(curl --fail --silent --show-error "https://api.github.com/repos/${REPO}/releases/tags/${VERSION}" || true)
if [[ -z $RELEASES_JSON ]]; then
echo "Error: Unable to fetch release metadata for tag ${VERSION}." 1>&2
exit 1
@ -126,6 +197,7 @@ DESTBIN="${DESTDIR}/bin/yt-dlp"
echo "--------------------------------------------------------------------------------"
echo "VERSION : ${VERSION}"
echo "LATEST : ${LATEST_TAG:-unknown}"
echo "CHANNEL : ${CHANNEL}"
echo "ASSET : ${ASSET_NAME}"
echo "DOWNLOAD: ${GITHUB_URL}"
echo "DESTDIR : ${DESTDIR}"