From 08681f0e335a59c6d50b664829c0583f1b42c90e Mon Sep 17 00:00:00 2001 From: Craig Alexander Date: Mon, 30 Jun 2025 23:09:18 -0400 Subject: [PATCH] Add option to update yt-dlp on restart (#992) * Add option to update yt-dlp on restart * Address pr feedback --- README.md | 1 + docker_assets/run.sh | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 7d3b2a96..9c50cd8c 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ All environment variables are explained in detail in the docs [here](https://doc | ELASTIC_USER | Change the default ElasticSearch user | Optional | | TA_LDAP | Configure TA to use LDAP Authentication | [Read more](https://docs.tubearchivist.com/configuration/ldap/) | | DISABLE_STATIC_AUTH | Remove authentication from media files, (Google Cast...) | [Read more](https://docs.tubearchivist.com/installation/env-vars/#disable_static_auth) | +| TA_AUTO_UPDATE_YTDLP | Configure TA to automatically install the latest yt-dlp on container start | Optional | | DJANGO_DEBUG | Return additional error messages, for debug only | Optional | | TA_LOGIN_AUTH_MODE | Configure the order of login authentication backends (Default: single) | Optional | diff --git a/docker_assets/run.sh b/docker_assets/run.sh index 9f065d7b..b09bee22 100644 --- a/docker_assets/run.sh +++ b/docker_assets/run.sh @@ -9,6 +9,15 @@ else LOGLEVEL="INFO" fi +# update yt-dlp if needed +if [[ "${TA_AUTO_UPDATE_YTDLP,,}" =~ ^(release|nightly)$ ]]; then + echo "Updating yt-dlp..." + preflag=$([[ "${TA_AUTO_UPDATE_YTDLP,,}" == "nightly" ]] && echo "--pre" || echo "") + python -m pip install --target=/root/.local/bin --upgrade $preflag "yt-dlp[default]" || { + echo "yt-dlp update failed" + } +fi + # stop on pending manual migration python manage.py ta_stop_on_error