Files
sailarr-installer/scripts/recyclarr-sync.sh
JaviPege 72704fd0a3 Update Recyclarr HDR Custom Format IDs to current TRaSH Guides
**Problem:**
Recyclarr was showing warnings about 9 obsolete HDR Custom Format IDs
that no longer exist in TRaSH Guides:
- e23edd2482476e595fb990b12e7c609c # DV HDR10 (old)
- 58d6a88f13e2db7f5059c41047876f00 # DV (old)
- 55d53828b9d81cbe20b02efd00aa0efd # DV HLG (old)
- a3e19f8f627608af0211acd02bf89735 # DV SDR (old)
- dfb86d5941bc9075d6af23b09c2aeecd # HDR10 (old)
- e61e28db95d22bedcadf030b8f156d96 # HDR (old)
- 2a4d9069cc1fe3242ff9bdaebed239bb # HDR (undefined) (old)
- 08d6d8834ad9ec87b1dc7ec8148e7a1f # PQ (old)
- 9364dd386c9b4a1100dde8264690add7 # HLG (old)

TRaSH Guides reorganized HDR Custom Formats with new IDs.

**Solution:**
1. Updated config/recyclarr.yml with current HDR format IDs
2. Replaced 9 obsolete IDs with 12 current IDs matching Sonarr config
3. Added UHD Streaming Boost and Cut formats
4. Fixed recyclarr-sync.sh API key injection using AWK instead of sed

**Changes:**
- config/recyclarr.yml: Updated Radarr HDR Custom Format IDs
- scripts/recyclarr-sync.sh: Fixed API key injection for both services

**Testing:**
Recyclarr sync now completes successfully without HDR-related warnings.
Both Radarr and Sonarr profiles updated correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 14:54:59 +02:00

73 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# MediaCenter - Recyclarr Sync Script
# Syncs TRaSH Guide quality profiles and naming conventions to Radarr/Sonarr
set -e
# Load environment
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Check if docker is available
if ! command -v docker &> /dev/null; then
echo "ERROR: Docker is not installed or not in PATH"
exit 1
fi
# Get API keys from Radarr and Sonarr
echo "Fetching API keys from Radarr and Sonarr..."
RADARR_API_KEY=$(docker exec radarr cat /config/config.xml 2>/dev/null | grep -oP '(?<=<ApiKey>)[^<]+' || echo "")
SONARR_API_KEY=$(docker exec sonarr cat /config/config.xml 2>/dev/null | grep -oP '(?<=<ApiKey>)[^<]+' || echo "")
if [ -z "$RADARR_API_KEY" ]; then
echo "ERROR: Could not fetch Radarr API key. Is Radarr running?"
exit 1
fi
if [ -z "$SONARR_API_KEY" ]; then
echo "ERROR: Could not fetch Sonarr API key. Is Sonarr running?"
exit 1
fi
echo "✓ API keys retrieved"
echo ""
echo "Running Recyclarr sync..."
echo "This will:"
echo " • Create/update quality profiles (Recyclarr-1080p, Recyclarr-2160p, Recyclarr-Any)"
echo " • Configure custom formats from TRaSH Guides"
echo " • Set up media naming conventions for Plex"
echo ""
# Create temporary config with API keys injected
TEMP_CONFIG="/tmp/recyclarr-temp-$$.yml"
awk -v radarr_key="${RADARR_API_KEY}" -v sonarr_key="${SONARR_API_KEY}" '
/^radarr:/ {in_radarr=1; in_sonarr=0}
/^sonarr:/ {in_radarr=0; in_sonarr=1}
/api_key:$/ {
if (in_radarr) {print " api_key: " radarr_key; next}
if (in_sonarr) {print " api_key: " sonarr_key; next}
}
{print}
' "${SCRIPT_DIR}/../config/recyclarr.yml" > "$TEMP_CONFIG"
# Run Recyclarr with Docker
docker run --rm \
--network mediacenter \
-v "${TEMP_CONFIG}:/config/recyclarr.yml:ro" \
ghcr.io/recyclarr/recyclarr:latest \
sync
# Cleanup
rm -f "$TEMP_CONFIG"
echo ""
echo "✓ Recyclarr sync completed successfully!"
echo ""
echo "Quality profiles created:"
echo " • Recyclarr-1080p - For 1080p content with upgrades to Remux"
echo " • Recyclarr-2160p - For 4K content with upgrades to Remux"
echo " • Recyclarr-Any - Accepts any quality, upgrades to best available"
echo ""
echo "Naming conventions configured for Plex compatibility"