transcode manager now handles multiple media servers

This commit is contained in:
2026-04-20 18:17:13 -04:00
parent e83473ab8e
commit 1a16ca02a9
5 changed files with 255 additions and 69 deletions
+52 -7
View File
@@ -444,11 +444,11 @@ HOST2_DDNS_CONTAINERS=(
# Own DDNS handled separately above — list additional containers here if needed
# These stop when this server loses internet — regardless of remote state
FAILOVER_HOST1_STOP_ON_NO_NET=(
"Gmer4Lfe.com" # add containers that should stop without internet
# "container-name" # add containers that should stop without internet
)
FAILOVER_HOST2_STOP_ON_NO_NET=(
"Gmer4Lfe.us"
# "container-name"
)
# ━━━ HOST1 runs these for HOST2 when HOST2 goes down ━━━
@@ -498,8 +498,7 @@ FAILOVER_HOST2_RUNS_FOR_HOST1_IMMEDIATE=(
"Dispatcharr" # Live TV — people are watching, cannot wait
"Dispatcharr-Basic" # Live TV basic profile
"Dispatcharr-Iptv-Users" # Live TV IPTV users
"ErsatzTV-Emby"
# "container-placeholder" # Live TV scheduling and channel management
"ErsatzTV-Emby" # Live TV scheduling and channel management
)
# Tier 2 — starts after HOST1_TIER2_DELAY minutes
@@ -1044,10 +1043,56 @@ RADARR_PROTECTED_PATTERNS=("*.jpg" "*.jpeg" "*.png" "*.nfo" "*.srt" "*.sub" "*.a
# switch to this mode to drain ramdisk sessions gracefully
TRANSCODE_MANAGER_MODE="smart" # smart | ramdisk | ssd
# Emby container check — skips threshold checks when Emby is not running
# Prevents unnecessary symlink flips when no transcoding is happening
# ━━━ Transcode Server Array ━━━
# All media servers that share the ramdisk transcode space.
# transcode_manager.sh reads this array and queries each server's API for active sessions.
# Session display, storage detection, and threshold decisions cover ALL servers combined.
#
# One entry → works exactly as before — single server behavior
# Many entries → aggregates sessions from all servers, one threshold on total ramdisk usage
#
# Each server writes to its own subfolder inside transcoding-temp:
# /mnt/ram-transcode/transcoding-temp/ABC123/ ← Emby session
# /mnt/ram-transcode/transcoding-temp/XYZ789/ ← Jellyfin session
# They never touch each other's files — the ramdisk is shared scratch space.
#
# Docker Extra Parameters — each media server container that uses the ramdisk needs:
# --mount type=bind,source=/mnt/ram-transcode,target=/ext-ram-transcode,bind-propagation=shared
# The target path (/ext-ram-transcode) must match what's configured in each server's
# transcoding settings. Use a different target path per container if needed.
#
# Format: "ContainerName|URL|APIKey|Type"
# ContainerName — exact Docker container name (used for running check)
# URL — API base URL including port
# APIKey — server API key (Emby/Jellyfin token, Plex token etc.)
# Type — emby | jellyfin | plex (controls API endpoint format)
#
# The first entry is the primary server — used for container running check
# (TRANSCODE_CHECK_EMBY still applies to first entry).
# Additional entries are queried if their container is running.
# Entries with placeholder APIKey values are skipped automatically.
#
# ⚠️ Tdarr does NOT belong here — Tdarr encodes full files, not HLS segments.
# Large working files would fill the ramdisk rapidly and cause constant flips.
# Keep Tdarr on SSD. Use tdarr_cleanup.sh for Tdarr orphan management.
TRANSCODE_SERVERS=(
"Emby|http://localhost:8096|0c27448d93a7431f9ac63569f7655829|emby"
# "Emby-Jayred365|http://HOST2-TAILSCALE-IP:8096|his-api-key|emby" # his Emby temporarily
# "Jellyfin|http://localhost:8097|jellyfin-api-key|jellyfin" # test Jellyfin instance
# "Plex|http://localhost:32400|plex-token|plex" # Plex if needed
)
# Container running check — still applies — skips threshold checks when no servers active
# Checked against the first entry in TRANSCODE_SERVERS automatically
TRANSCODE_CHECK_EMBY=true
TRANSCODE_EMBY_CONTAINER="Emby" # exact Docker container name — case sensitive
# Per-host Emby container names for database repair
# HOST1 repairs its own personal Emby + the shared production Emby
# HOST2 repairs its own personal Emby
# detect_hosts() selects the correct container at runtime
HOST1_EMBY_REPAIR_CONTAINER="Emby" # shared production Emby lives on HOST1
HOST2_EMBY_REPAIR_CONTAINER="Emby-Jayred365" # HOST2's personal Emby instance
# Daily transcode statistics log — read by weekly_health_digest.sh
# Tracks peak usage, flip count, session ratio, files cleaned per day