feat: add install.sh for targeted plugin updates via raw file URLs
Build / Lint & Test (push) Successful in 11s
Build / Lint & Test (push) Successful in 11s
This commit is contained in:
1 parent
303c3b9fd3
commit
3b7f660058
2 files changed
+138
-40
No files matched your search
+95
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
# install.sh — Update Tdarr plugins from Gitea raw file URLs.
|
||||
#
|
||||
# Usage:
|
||||
# ./install.sh <PLUGIN_DIR> # update ALL plugins
|
||||
# ./install.sh <PLUGIN_DIR> transcode2PassX265 # update ONE plugin
|
||||
# ./install.sh <PLUGIN_DIR> p1 p2 p3 # update MULTIPLE plugins
|
||||
#
|
||||
# Or pipe directly from Gitea (no clone needed):
|
||||
# curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/raw/branch/main/install.sh \
|
||||
# | bash -s -- /your/tdarr/plugins/FlowPlugins
|
||||
#
|
||||
# Environment overrides:
|
||||
# GITEA_URL — base URL of the Gitea instance (default below)
|
||||
# GITEA_BRANCH — branch to pull from (default: main)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# ── Config ────────────────────────────────────────────────────────────────────
|
||||
GITEA_URL="${GITEA_URL:-https://git.cdtech.freeddns.org}"
|
||||
GITEA_REPO="PickleRick/Tdarr-plugin"
|
||||
BRANCH="${GITEA_BRANCH:-main}"
|
||||
RAW="${GITEA_URL}/${GITEA_REPO}/raw/branch/${BRANCH}"
|
||||
|
||||
# Map: plugin-name → category
|
||||
declare -A PLUGIN_CATEGORY=(
|
||||
[mediaAnalyzerGOP]=utility
|
||||
[setAnimationFlag]=utility
|
||||
[extractChaptersXml]=utility
|
||||
[audioSelectorClamping]=audio
|
||||
[backupSourceAudio]=audio
|
||||
[extractSubtitlesAndOcr]=subtitles
|
||||
[transcode2PassX265]=video
|
||||
)
|
||||
|
||||
# ── Args ──────────────────────────────────────────────────────────────────────
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Usage: $0 <PLUGIN_DIR> [plugin1 plugin2 ...]"
|
||||
echo ""
|
||||
echo " PLUGIN_DIR — path that contains LocalFlowPlugins/"
|
||||
echo " (e.g. /docker/tdarr/data/Tdarr/Plugins/FlowPlugins)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PLUGIN_DIR="$1"
|
||||
shift
|
||||
|
||||
# If no specific plugins requested, update all
|
||||
if [[ $# -eq 0 ]]; then
|
||||
TARGETS=("${!PLUGIN_CATEGORY[@]}")
|
||||
else
|
||||
TARGETS=("$@")
|
||||
fi
|
||||
|
||||
# ── Download helper ───────────────────────────────────────────────────────────
|
||||
download_plugin() {
|
||||
local name="$1"
|
||||
local category="${PLUGIN_CATEGORY[$name]:-}"
|
||||
|
||||
if [[ -z "$category" ]]; then
|
||||
echo " ✗ Unknown plugin '${name}' — skipping."
|
||||
return 1
|
||||
fi
|
||||
|
||||
local dest="${PLUGIN_DIR}/LocalFlowPlugins/${category}/${name}/1.0.0"
|
||||
local url="${RAW}/LocalFlowPlugins/${category}/${name}/1.0.0/index.js"
|
||||
|
||||
mkdir -p "$dest"
|
||||
if curl -fsSL "$url" -o "${dest}/index.js"; then
|
||||
echo " ✓ ${name} → ${dest}/index.js"
|
||||
else
|
||||
echo " ✗ Failed to download ${name} from ${url}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# ── Run ───────────────────────────────────────────────────────────────────────
|
||||
echo "=== Tdarr Plugin Updater ==="
|
||||
echo " Source : ${GITEA_URL}/${GITEA_REPO} (branch: ${BRANCH})"
|
||||
echo " Target : ${PLUGIN_DIR}"
|
||||
echo ""
|
||||
|
||||
ERRORS=0
|
||||
for plugin in "${TARGETS[@]}"; do
|
||||
download_plugin "$plugin" || ERRORS=$((ERRORS + 1))
|
||||
done
|
||||
|
||||
echo ""
|
||||
if [[ $ERRORS -eq 0 ]]; then
|
||||
echo "✅ Done. Restart Tdarr server to pick up changes:"
|
||||
echo " docker restart tdarr-server"
|
||||
else
|
||||
echo "⚠️ Done with ${ERRORS} error(s). Check output above."
|
||||
exit 1
|
||||
fi
|
||||
Reference in new issue
Block a user