From 036b12382e0f086938d9d226f0a1eb78e3e2e682 Mon Sep 17 00:00:00 2001 From: Roland Date: Thu, 23 Jan 2025 17:46:37 -0700 Subject: [PATCH] Creating script which updates yt-dlp in the wrolpi venv to the latest available. --- scripts/upgrade_yt-dlp.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 scripts/upgrade_yt-dlp.sh diff --git a/scripts/upgrade_yt-dlp.sh b/scripts/upgrade_yt-dlp.sh new file mode 100755 index 00000000..892d6f98 --- /dev/null +++ b/scripts/upgrade_yt-dlp.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env bash + +set -e + +# Re-execute this script if it wasn't called with sudo. +if [ "$(whoami)" != "wrolpi" ]; then + sudo -u wrolpi "$0" "$@" + exit $? +fi + +. /opt/wrolpi/venv/bin/activate +if pip install --upgrade yt-dlp | grep -q "Successfully installed"; then + echo "yt-dlp was upgraded." + echo "You must restart the API:" + echo " sudo systemctl restart wrolpi-api" + exit 0 +else + echo "yt-dlp is already up to date" + exit 1 +fi