Files
linux_script/updateYtdlpForVideoTranslation.sh

39 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
echo "[$(date '+%F %T')] Starting updateYtdlpForVideoTranslation.sh"
PACKAGE_DIR="/home/awin/codes/videoTranslationPackage"
HTTP_DIR="/home/awin/codes/videoTranslationHttp"
DEPLOY_DIR="/DATA01/dockers/videoTranslationHttp"
# Update yt-dlp in videoTranslationPackage and rebuild the wheel.
cd "$PACKAGE_DIR"
rm -f "$PACKAGE_DIR"/dist/*.whl "$PACKAGE_DIR"/dist/*.tar.gz
./build.sh
wheel_paths=("$PACKAGE_DIR"/dist/*.whl)
if [ "${#wheel_paths[@]}" -ne 1 ]; then
echo "[ERROR] Expected exactly one wheel in $PACKAGE_DIR/dist, found ${#wheel_paths[@]}"
exit 1
fi
wheel_path="${wheel_paths[0]}"
# Update videoTranslationPackage in videoTranslationHttp.
cd "$HTTP_DIR"
rm -f "$HTTP_DIR"/dependencies/videotranslation-*.whl
cp "$wheel_path" "$HTTP_DIR"/dependencies/
uv remove videoTranslation
uv add "$HTTP_DIR"/dependencies/$(basename "$wheel_path")
# Build docker image of videoTranslationHttp.
./build_docker.sh
# Go to docker folder and use new image.
cd "$DEPLOY_DIR"
docker compose down
docker compose up -d --force-recreate
echo "[$(date '+%F %T')] Finished updateYtdlpForVideoTranslation.sh"