#!/bin/bash # Install/upgrade the Vanguard Metadata Jellyfin plugin from jellyfin-plugin-vanguard/dist/*.zip # (built on a dev box with ./package.sh and scp'd up with the bundle). Re-runnable. # Removes older versions of the same plugin so Jellyfin loads exactly one. set -euo pipefail cd "$(dirname "$0")" PLUGDIR=/srv/appdata/jellyfin/config/plugins NAME="Vanguard Metadata" mkdir -p jellyfin-plugin-vanguard/dist ZIP=$(ls -1 jellyfin-plugin-vanguard/dist/VanguardMetadata_*.zip 2>/dev/null | sort -V | tail -1 || true) [[ -n $ZIP ]] || { echo "no plugin zip in jellyfin-plugin-vanguard/dist/ — build with ./package.sh on the dev box, then:"; echo " scp jellyfin-plugin-vanguard/dist/VanguardMetadata_*.zip debian@HOST:~/vanguard-stream/jellyfin-plugin-vanguard/dist/"; exit 1; } VER=$(basename "$ZIP" .zip | sed 's/^VanguardMetadata_//') DEST="$PLUGDIR/${NAME}_${VER}" if [[ -f "$DEST/meta.json" ]] && grep -q "\"version\": \"$VER\"" "$DEST/meta.json"; then echo "plugin $VER already installed at $DEST"; exit 0 fi sudo install -d -o 1000 -g 1000 "$PLUGDIR" for old in "$PLUGDIR/${NAME}_"*/; do [[ -d $old && $old != "$DEST/" ]] && { echo "removing old $old"; sudo rm -rf "$old"; }; done sudo -u "#1000" mkdir -p "$DEST" sudo -u "#1000" python3 -m zipfile -e "$ZIP" "$DEST/" echo "installed $NAME $VER -> $DEST" ls -la "$DEST" if docker ps --format '{{.Names}}' | grep -qx jellyfin; then docker compose restart jellyfin sleep 8 docker logs jellyfin --tail 60 2>&1 | grep -iE "vanguard|Loaded plugin" | tail -3 || true fi