Compare commits

...
Author SHA1 Message Date
MickLesk c8c150c18f MusicGrabber: read Python and the packages from upstream's Dockerfile
The pins in the scripts were a copy of the Dockerfile and went stale with
every release: upstream is on Python 3.15, apprise 2 and PyJWT by now. Both
scripts now read the Python version and the pip packages from the Dockerfile
of the release they deploy.

The update reads them before it stops the service and changes nothing when
the Dockerfile no longer names them. It rebuilds the venv, so dropped
packages and a new Python version arrive as well.
2026-12-06 10:47:56 +01:00
CanbiZ (MickLesk) ebd8a870a5 fix update check
Remove commented line about stopped service.
2026-12-06 10:18:01 +01:00
MickLesk a07327d882 MusicGrabber: install the FLAC Verifier from its release binary
MusicGrabber 4.7.1 replaced the Python engine with a static binary, so the
commit the scripts read from the Dockerfile is gone and every install and
update has ended in a 404 since. The version now comes from the release URL
in the Dockerfile, and a Dockerfile without one only leaves the check off.

An update also runs when the service is stopped: that is the state the
failed update left behind, with the stamp already at the new version.
2026-12-06 10:07:47 +01:00
2 changed files with 43 additions and 35 deletions

No files matched your search

+25 -15
View File
@@ -32,37 +32,47 @@ function update_script() {
fi
RELEASE=$(get_latest_gl_tag "g33kphr33k/musicgrabber" "v*")
if [[ "$RELEASE" == "$(cat ~/.musicgrabber 2>/dev/null)" ]]; then
if [[ "$RELEASE" == "$(cat ~/.musicgrabber 2>/dev/null)" ]] && systemctl is-active -q musicgrabber; then
msg_ok "No update required. ${APP} is already at ${RELEASE}"
exit
fi
DOCKERFILE="$(curl -fsSL "https://gitlab.com/g33kphr33k/musicgrabber/-/raw/${RELEASE}/Dockerfile")"
PYTHON_VERSION="$(grep -oP '^FROM python:\K[0-9]+\.[0-9]+' <<<"$DOCKERFILE" | tail -n1 || true)"
mapfile -t PIP_DEPS < <(awk '{ if (sub(/\\$/, "")) printf "%s ", $0; else print }' <<<"$DOCKERFILE" | sed 's/&&/\n/g' | sed -n -E 's/^(RUN)?[[:space:]]*pip install //p' | tr -d "\"'" | tr -s ' ' '\n' | grep -E '^[A-Za-z0-9][A-Za-z0-9._-]*(\[[A-Za-z0-9,_-]+\])?([~=!<>]=?[^[:space:]]+)?$')
if [[ -z "$PYTHON_VERSION" || ${#PIP_DEPS[@]} -eq 0 ]]; then
msg_error "MusicGrabber ${RELEASE} does not name its Python version and packages in the Dockerfile. Nothing was changed."
exit 250
fi
msg_info "Stopping MusicGrabber"
systemctl stop musicgrabber
msg_ok "Stopped MusicGrabber"
setup_uv
fetch_and_deploy_gh_release "yt-dlp" "yt-dlp/yt-dlp" "singlefile" "latest" "/usr/local/bin" "yt-dlp_$(arch_resolve "linux" "linux_aarch64")"
fetch_and_deploy_gh_release "deno" "denoland/deno" "prebuild" "latest" "/usr/local/bin" "deno-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.zip"
CLEAN_INSTALL=1 CLEAN_INSTALL_KEEP=".venv" fetch_and_deploy_gl_tag "musicgrabber" "g33kphr33k/musicgrabber" "$RELEASE"
CLEAN_INSTALL=1 fetch_and_deploy_gl_tag "musicgrabber" "g33kphr33k/musicgrabber" "$RELEASE"
msg_info "Updating MusicGrabber"
cd /opt/musicgrabber
$STD uv pip install --python .venv/bin/python \
"fastapi~=0.162.0" \
"uvicorn[standard]~=0.54.0" \
"httpx~=0.28.1" \
"pydantic~=2.14.1" \
"mutagen~=1.48.1" \
"playwright~=1.64.1" \
"apprise>=1.13.1,<2" \
"bcrypt~=4.3.0" \
"pycryptodome~=4.2.0" \
"certifi>=2026.10.18" \
"seleniumbase>=4.54,<5"
$STD uv venv --clear --python "$PYTHON_VERSION" .venv
$STD uv pip install --python .venv/bin/python "${PIP_DEPS[@]}"
PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright $STD .venv/bin/playwright install chromium
if [[ "$(arch_resolve)" == "amd64" ]]; then
$STD .venv/bin/sbase get uc_driver stable
else
install -m 755 /usr/bin/chromedriver ".venv/lib/python${PYTHON_VERSION}/site-packages/seleniumbase/drivers/uc_driver"
fi
$STD .venv/bin/python -c "from pathlib import Path; import seleniumbase; from seleniumbase.undetected.patcher import Patcher; driver = Path(seleniumbase.__file__).parent / 'drivers' / 'uc_driver'; Patcher(executable_path=str(driver)).auto(); driver.chmod(0o755)"
msg_ok "Updated MusicGrabber"
CLEAN_INSTALL=1 fetch_and_deploy_from_url "https://codeload.github.com/FraysKosher/flac-verifier/tar.gz/$(grep -oP 'FraysKosher/flac-verifier/tar.gz/\K[0-9a-f]+' /opt/musicgrabber/Dockerfile)" "/opt/flac-verifier/engine"
FLAC_VERIFIER_VERSION="$(grep -m1 -oP 'flac-verifier/releases/download/v\K[0-9.]+' /opt/musicgrabber/Dockerfile || true)"
if [[ -n "$FLAC_VERIFIER_VERSION" ]]; then
CLEAN_INSTALL=1 fetch_and_deploy_from_url "https://github.com/FraysKosher/flac-verifier/releases/download/v${FLAC_VERIFIER_VERSION}/flac-verifier-cli-${FLAC_VERIFIER_VERSION}-$(arch_resolve "x86_64" "aarch64")-unknown-linux-musl.tar.gz" "/opt/flac-verifier"
else
msg_warn "MusicGrabber names no FLAC Verifier release, the lossless check stays unavailable"
fi
msg_info "Starting MusicGrabber"
systemctl start musicgrabber
+18 -20
View File
@@ -21,26 +21,23 @@ $STD apt install -y \
msg_ok "Installed Dependencies"
setup_ffmpeg
PYTHON_VERSION="3.12" setup_uv
fetch_and_deploy_gh_release "yt-dlp" "yt-dlp/yt-dlp" "singlefile" "latest" "/usr/local/bin" "yt-dlp_$(arch_resolve "linux" "linux_aarch64")"
fetch_and_deploy_gh_release "deno" "denoland/deno" "prebuild" "latest" "/usr/local/bin" "deno-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.zip"
fetch_and_deploy_gl_tag "musicgrabber" "g33kphr33k/musicgrabber" "v*"
DOCKERFILE="$(</opt/musicgrabber/Dockerfile)"
PYTHON_VERSION="$(grep -oP '^FROM python:\K[0-9]+\.[0-9]+' <<<"$DOCKERFILE" | tail -n1 || true)"
mapfile -t PIP_DEPS < <(awk '{ if (sub(/\\$/, "")) printf "%s ", $0; else print }' <<<"$DOCKERFILE" | sed 's/&&/\n/g' | sed -n -E 's/^(RUN)?[[:space:]]*pip install //p' | tr -d "\"'" | tr -s ' ' '\n' | grep -E '^[A-Za-z0-9][A-Za-z0-9._-]*(\[[A-Za-z0-9,_-]+\])?([~=!<>]=?[^[:space:]]+)?$')
if [[ -z "$PYTHON_VERSION" || ${#PIP_DEPS[@]} -eq 0 ]]; then
msg_error "MusicGrabber's Dockerfile does not name its Python version and packages"
exit 250
fi
setup_uv
msg_info "Setting up MusicGrabber"
cd /opt/musicgrabber
$STD uv venv --python 3.12 .venv
$STD uv pip install --python .venv/bin/python \
"fastapi~=0.162.0" \
"uvicorn[standard]~=0.54.0" \
"httpx~=0.28.1" \
"pydantic~=2.14.1" \
"mutagen~=1.48.1" \
"playwright~=1.64.1" \
"apprise>=1.13.1,<2" \
"bcrypt~=4.3.0" \
"pycryptodome~=4.2.0" \
"certifi>=2026.10.18" \
"seleniumbase>=4.54,<5"
$STD uv venv --python "$PYTHON_VERSION" .venv
$STD uv pip install --python .venv/bin/python "${PIP_DEPS[@]}"
PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright $STD .venv/bin/playwright install --with-deps chromium
msg_ok "Set up MusicGrabber"
@@ -56,16 +53,17 @@ if [[ "$(arch_resolve)" == "amd64" ]]; then
$STD .venv/bin/sbase get uc_driver stable
else
$STD apt install -y chromium chromium-driver
install -m 755 /usr/bin/chromedriver .venv/lib/python3.12/site-packages/seleniumbase/drivers/uc_driver
install -m 755 /usr/bin/chromedriver ".venv/lib/python${PYTHON_VERSION}/site-packages/seleniumbase/drivers/uc_driver"
fi
$STD .venv/bin/python -c "from pathlib import Path; import seleniumbase; from seleniumbase.undetected.patcher import Patcher; driver = Path(seleniumbase.__file__).parent / 'drivers' / 'uc_driver'; Patcher(executable_path=str(driver)).auto(); driver.chmod(0o755)"
msg_ok "Installed Browser for SeleniumBase"
msg_info "Setting up FLAC Verifier"
$STD uv venv --python 3.12 /opt/flac-verifier
$STD uv pip install --python /opt/flac-verifier/bin/python "numpy==2.2.6" "scipy==1.15.3" "soundfile==0.13.1" "mutagen==1.47.0"
msg_ok "Set up FLAC Verifier"
fetch_and_deploy_from_url "https://codeload.github.com/FraysKosher/flac-verifier/tar.gz/$(grep -oP 'FraysKosher/flac-verifier/tar.gz/\K[0-9a-f]+' /opt/musicgrabber/Dockerfile)" "/opt/flac-verifier/engine"
FLAC_VERIFIER_VERSION="$(grep -m1 -oP 'flac-verifier/releases/download/v\K[0-9.]+' /opt/musicgrabber/Dockerfile || true)"
if [[ -n "$FLAC_VERIFIER_VERSION" ]]; then
fetch_and_deploy_from_url "https://github.com/FraysKosher/flac-verifier/releases/download/v${FLAC_VERIFIER_VERSION}/flac-verifier-cli-${FLAC_VERIFIER_VERSION}-$(arch_resolve "x86_64" "aarch64")-unknown-linux-musl.tar.gz" "/opt/flac-verifier"
else
msg_warn "MusicGrabber names no FLAC Verifier release, the lossless check stays unavailable"
fi
msg_info "Configuring MusicGrabber"
mkdir -p /opt/musicgrabber_data/music