From f1bb19d665d4b1deb20ec509c40e07e46ce3c4e0 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Fri, 13 Jun 2025 14:35:30 +0200 Subject: [PATCH] Update LibreTranslate --- ct/libretranslate.sh | 17 +++++++---------- install/libretranslate-install.sh | 17 +++++++++++------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ct/libretranslate.sh b/ct/libretranslate.sh index 67a6e92f..29455985 100644 --- a/ct/libretranslate.sh +++ b/ct/libretranslate.sh @@ -28,23 +28,20 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - RELEASE=$(curl -s https://api.github.com/repos/Casvt/Kapowarr/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') - if [[ "${RELEASE}" != "$(cat $HOME/.kapowarr)" ]] || [[ ! -f $HOME/.kapowarr ]]; then + RELEASE=$(curl -s https://api.github.com/repos/LibreTranslate/LibreTranslate/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat $HOME/.libretranslate)" ]] || [[ ! -f $HOME/.libretranslate ]]; then msg_info "Stopping $APP" - systemctl stop kapowarr + systemctl stop libretranslate msg_ok "Stopped $APP" - msg_info "Creating Backup" - mv /opt/kapowarr/db /opt/ - msg_ok "Backup Created" - msg_info "Updating $APP to ${RELEASE}" - fetch_and_deploy_gh_release "kapowarr" "Casvt/Kapowarr" - mv /opt/db /opt/kapowarr + cd /opt/libretranslate + source .venv/bin/activate + $STD pip install -U libretranslate msg_ok "Updated $APP to ${RELEASE}" msg_info "Starting $APP" - systemctl start kapowarr + systemctl start libretranslate msg_ok "Started $APP" msg_ok "Update Successful" diff --git a/install/libretranslate-install.sh b/install/libretranslate-install.sh index 8c02f880..febc38f1 100644 --- a/install/libretranslate-install.sh +++ b/install/libretranslate-install.sh @@ -17,11 +17,15 @@ msg_info "Installing dependencies" $STD apt-get install -y --no-install-recommends \ pkg-config \ gcc \ - g++ -msg_ok "Setup Python3" + g++ \ + libicu-dev +msg_ok "Installed dependencies" msg_info "Setup Python3" -$STD apt-get install -y python3-pip +$STD apt-get install -y \ + python3-pip \ + python3-dev \ + python3-icu msg_ok "Setup Python3" setup_uv @@ -31,8 +35,9 @@ msg_info "Setup LibreTranslate (Patience)" cd /opt/libretranslate $STD uv venv .venv $STD source .venv/bin/activate -$STD uv pip install --upgrade pip -$STD uv pip install Babel==2.12.1 && .venv/bin/python scripts/compile_locales.py +$STD uv pip install --upgrade pip setuptools +$STD uv pip install Babel==2.12.1 +$STD .venv/bin/python scripts/compile_locales.py $STD uv pip install torch==2.2.0 --extra-index-url https://download.pytorch.org/whl/cpu $STD uv pip install "numpy<2" $STD uv pip install . @@ -51,7 +56,7 @@ User=root Type=idle Restart=always Environment="PATH=/usr/local/lib/python3.11/dist-packages/libretranslate" -ExecStart=/opt/libretranslate/.venv/bin/python3 /opt/libretranslate/.venv/bin/libretranslate --host * +ExecStart=/opt/libretranslate/.venv/bin/python3 /opt/libretranslate/.venv/bin/libretranslate --host * --update-models ExecReload=/bin/kill -s HUP KillMode=mixed TimeoutStopSec=1