From 3b7f6600585c5de17b7b7b98eb0699456c9bcacc Mon Sep 17 00:00:00 2001 From: PickleRick Date: Sat, 19 Sep 2026 14:15:35 +0200 Subject: [PATCH] feat: add install.sh for targeted plugin updates via raw file URLs --- README.md | 83 ++++++++++++++++++++++++----------------------- install.sh | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 40 deletions(-) create mode 100644 install.sh diff --git a/README.md b/README.md index bcec274..eea3c81 100644 --- a/README.md +++ b/README.md @@ -6,72 +6,75 @@ A collection of [Tdarr](https://tdarr.io/) Flow plugins for automated media tran --- -## ⚡ Quick Install via curl +## ⚡ Quick Install / Update via curl -> **How it works**: Gitea serves a real ZIP of any branch at `/archive/.zip`. -> This is a built-in git archive — **no release workflow required**, always up to date. +### Recommended — `install.sh` (no ZIP, no clone) -### Full Suite (all 7 plugins) +The repo includes an [`install.sh`](install.sh) script that downloads only the `index.js` +files you need directly from Gitea raw URLs. +**Update all plugins at once:** ```bash -PLUGIN_DIR=/path/to/tdarr/plugins/FlowPlugins - -# Download a live ZIP of the main branch directly from Gitea -curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/archive/main.zip \ - -o /tmp/tdarr-plugins.zip - -# Extract and copy into your plugin directory -unzip -q -o /tmp/tdarr-plugins.zip -d /tmp/tdarr-extract -cp -r /tmp/tdarr-extract/Tdarr-plugin/LocalFlowPlugins "${PLUGIN_DIR}/" -cp -r /tmp/tdarr-extract/Tdarr-plugin/FlowHelpers "${PLUGIN_DIR}/" -rm -rf /tmp/tdarr-plugins.zip /tmp/tdarr-extract +curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/raw/branch/main/install.sh \ + | bash -s -- /your/tdarr/plugins/FlowPlugins ``` -After extracting, restart the Tdarr server so it picks up the new plugins: +**Update a single plugin** (e.g. after a bug fix): +```bash +curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/raw/branch/main/install.sh \ + | bash -s -- /your/tdarr/plugins/FlowPlugins transcode2PassX265 +``` +**Update two specific plugins:** +```bash +curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/raw/branch/main/install.sh \ + | bash -s -- /your/tdarr/plugins/FlowPlugins transcode2PassX265 extractSubtitlesAndOcr +``` + +Then restart Tdarr: ```bash docker restart tdarr-server ``` -### One-liner (copy-paste for Docker hosts) +--- + +### Alternative — Full ZIP (first install) ```bash -PLUGIN_DIR=/your/tdarr/plugins/FlowPlugins && \ -curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/archive/main.zip -o /tmp/tp.zip && \ -unzip -q -o /tmp/tp.zip -d /tmp/tpx && \ -cp -r /tmp/tpx/Tdarr-plugin/LocalFlowPlugins "${PLUGIN_DIR}/" && \ -cp -r /tmp/tpx/Tdarr-plugin/FlowHelpers "${PLUGIN_DIR}/" && \ -rm -rf /tmp/tp.zip /tmp/tpx && \ -docker restart tdarr-server && echo "Done." +PLUGIN_DIR=/path/to/tdarr/plugins/FlowPlugins + +curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/archive/main.zip \ + -o /tmp/tdarr-plugins.zip +unzip -q -o /tmp/tdarr-plugins.zip -d /tmp/tdarr-extract +cp -r /tmp/tdarr-extract/Tdarr-plugin/LocalFlowPlugins "${PLUGIN_DIR}/" +cp -r /tmp/tdarr-extract/Tdarr-plugin/FlowHelpers "${PLUGIN_DIR}/" +rm -rf /tmp/tdarr-plugins.zip /tmp/tdarr-extract +docker restart tdarr-server ``` -### Individual Plugin (single raw file) - -Each plugin is a single `index.js` file. Download just what you need: +### Alternative — Single raw file ```bash -# Example: transcode2PassX265 BASE=https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/raw/branch/main PLUGIN=transcode2PassX265 CATEGORY=video DEST=/path/to/tdarr/plugins/FlowPlugins/LocalFlowPlugins/${CATEGORY}/${PLUGIN}/1.0.0 mkdir -p "${DEST}" -curl -fsSL "${BASE}/LocalFlowPlugins/${CATEGORY}/${PLUGIN}/1.0.0/index.js" \ - -o "${DEST}/index.js" +curl -fsSL "${BASE}/LocalFlowPlugins/${CATEGORY}/${PLUGIN}/1.0.0/index.js" -o "${DEST}/index.js" ``` -| Plugin | Category | Path segment | -|---|---|---| -| `mediaAnalyzerGOP` | `utility` | `LocalFlowPlugins/utility/mediaAnalyzerGOP/1.0.0/index.js` | -| `setAnimationFlag` | `utility` | `LocalFlowPlugins/utility/setAnimationFlag/1.0.0/index.js` | -| `extractChaptersXml` | `utility` | `LocalFlowPlugins/utility/extractChaptersXml/1.0.0/index.js` | -| `audioSelectorClamping` | `audio` | `LocalFlowPlugins/audio/audioSelectorClamping/1.0.0/index.js` | -| `backupSourceAudio` | `audio` | `LocalFlowPlugins/audio/backupSourceAudio/1.0.0/index.js` | -| `extractSubtitlesAndOcr` | `subtitles` | `LocalFlowPlugins/subtitles/extractSubtitlesAndOcr/1.0.0/index.js` | -| `transcode2PassX265` | `video` | `LocalFlowPlugins/video/transcode2PassX265/1.0.0/index.js` | +| Plugin | Category | +|---|---| +| `mediaAnalyzerGOP` | `utility` | +| `setAnimationFlag` | `utility` | +| `extractChaptersXml` | `utility` | +| `audioSelectorClamping` | `audio` | +| `backupSourceAudio` | `audio` | +| `extractSubtitlesAndOcr` | `subtitles` | +| `transcode2PassX265` | `video` | -### Tagged Releases (optional, requires CI push) +### Tagged Releases (versioned ZIPs) Once a release is published by the CI workflow, versioned ZIPs are also available: diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..7403fdd --- /dev/null +++ b/install.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +# install.sh — Update Tdarr plugins from Gitea raw file URLs. +# +# Usage: +# ./install.sh # update ALL plugins +# ./install.sh transcode2PassX265 # update ONE plugin +# ./install.sh 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 [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