Files
jellyfin-plugin-floatplane/scripts/package.sh
claude bf476134c2
Some checks failed
release / build-release (push) Has been cancelled
v0.2: All videos folder, shared watched state, release-order sorting, official icon, OAuth plumbing, docs
- per-creator "All videos" folder (release order across sub-channels); sub-channel copies use
  cpost: ids and UserDataMirror keeps played/resume state in sync
- SortNameUpdater forces release-order sort names so every client lists newest first by default
- official Floatplane icon as channel image (Primary only — a channel Thumb hid video thumbnails
  in Continue Watching) and as 16:9 plugin thumbnail; one-time image replacement on upgrade
- OAuth device-flow login (FloatplaneAuthService + settings UI); needs a Floatplane client id;
  Turnstile verified domain-bound so password login inside Jellyfin is impossible
- generic install.sh (linuxserver / official image / native), thumb.png in package + manifest
- README rewritten for a general audience, doc/usage.md with screenshots, 60 tests

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 16:36:32 +01:00

64 lines
3.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the plugin and produces what Jellyfin needs to install it:
# build/Floatplane_<ver>/ plugin folder (DLL + meta.json) -> copy into <jellyfin>/plugins/
# build/floatplane_<ver>.zip plugin package -> release asset
# build/floatplane_<ver>.zip.md5 checksum
# build/manifest.json plugin-repository manifest (needs BASE_URL)
#
# Usage: scripts/package.sh [version] [base-url-for-zip]
# version defaults to the version in build.yaml; CI passes X.Y.Z.N
# base-url URL prefix where the zip will be downloadable (for manifest.json sourceUrl)
set -euo pipefail
cd "$(dirname "$0")/.."
VERSION="${1:-$(sed -n 's/^version: *"\(.*\)"/\1/p' build.yaml)}"
BASE_URL="${2:-}"
NAME=$(sed -n 's/^name: *"\(.*\)"/\1/p' build.yaml)
GUID=$(sed -n 's/^guid: *"\(.*\)"/\1/p' build.yaml)
ABI=$(sed -n 's/^targetAbi: *"\(.*\)"/\1/p' build.yaml)
OVERVIEW=$(sed -n 's/^overview: *"\(.*\)"/\1/p' build.yaml)
CATEGORY=$(sed -n 's/^category: *"\(.*\)"/\1/p' build.yaml)
OWNER=$(sed -n 's/^owner: *"\(.*\)"/\1/p' build.yaml)
# multi-line "description: >" and "changelog: >" blocks → single line
DESCRIPTION=$(awk '/^description: >/{f=1;next} /^[a-z]/{f=0} f{gsub(/^ +/,""); printf "%s ", $0}' build.yaml | sed 's/ *$//')
CHANGELOG=$(awk '/^changelog: >/{f=1;next} /^[a-z]/{f=0} f{gsub(/^ +/,""); printf "%s ", $0}' build.yaml | sed 's/ *$//')
SLUG=$(echo "$NAME" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9\n' '_')
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
rm -rf build/publish "build/${NAME}_${VERSION}" "build/${SLUG}_${VERSION}.zip"*
mkdir -p build
dotnet publish Jellyfin.Plugin.Floatplane/Jellyfin.Plugin.Floatplane.csproj \
-c Release -o build/publish -p:Version="$VERSION" -p:AssemblyVersion="$VERSION" -p:FileVersion="$VERSION" --nologo
PLUGIN_DIR="build/${NAME}_${VERSION}"
mkdir -p "$PLUGIN_DIR"
cp build/publish/Jellyfin.Plugin.Floatplane.dll "$PLUGIN_DIR/"
cp Jellyfin.Plugin.Floatplane/Resources/thumb.png "$PLUGIN_DIR/thumb.png" # shown in Dashboard -> Plugins
cp Jellyfin.Plugin.Floatplane/Resources/thumb.png build/thumb.png # release asset for manifest imageUrl
jq -n --arg guid "$GUID" --arg name "$NAME" --arg desc "$DESCRIPTION" --arg ov "$OVERVIEW" \
--arg owner "$OWNER" --arg cat "$CATEGORY" --arg ver "$VERSION" --arg cl "$CHANGELOG" \
--arg abi "$ABI" --arg ts "$TS" \
'{guid:$guid, name:$name, description:$desc, overview:$ov, owner:$owner, category:$cat,
version:$ver, changelog:$cl, targetAbi:$abi, timestamp:$ts, status:"Active", autoUpdate:true,
imagePath:"thumb.png", assemblies:["Jellyfin.Plugin.Floatplane.dll"]}' > "$PLUGIN_DIR/meta.json"
ZIP="build/${SLUG}_${VERSION}.zip"
(cd "$PLUGIN_DIR" && zip -q -j "../../$ZIP" Jellyfin.Plugin.Floatplane.dll meta.json thumb.png)
MD5=$(md5sum "$ZIP" | cut -d' ' -f1)
echo "$MD5 $(basename "$ZIP")" > "$ZIP.md5"
if [ -n "$BASE_URL" ]; then
jq -n --arg guid "$GUID" --arg name "$NAME" --arg desc "$DESCRIPTION" --arg ov "$OVERVIEW" \
--arg owner "$OWNER" --arg cat "$CATEGORY" --arg ver "$VERSION" --arg cl "$CHANGELOG" \
--arg abi "$ABI" --arg ts "$TS" --arg md5 "$MD5" --arg url "${BASE_URL%/}/$(basename "$ZIP")" \
--arg img "${BASE_URL%/}/thumb.png" \
'[{guid:$guid, name:$name, description:$desc, overview:$ov, owner:$owner, category:$cat, imageUrl:$img,
versions:[{version:$ver, changelog:$cl, targetAbi:$abi, sourceUrl:$url, checksum:$md5, timestamp:$ts}]}]' \
> build/manifest.json
fi
echo "plugin folder: $PLUGIN_DIR"
echo "package: $ZIP (md5 $MD5)"
[ -n "$BASE_URL" ] && echo "manifest: build/manifest.json -> $BASE_URL"
exit 0