Files
buryan-infra/ops/media/2026-10-19-seerr/04-arr-fix.sh
T

59 lines
2.8 KiB
Bash

#!/bin/bash
# ============================================================
# SEERR: подключаю Sonarr и Radarr (с полным набором полей)
# ============================================================
set -uo pipefail
S=http://192.168.1.121:5055/api/v1
JAR=/tmp/seerr.jar
echo "=== SONARR ==="
CODE=$(curl -s -o /tmp/s4.out -b "$JAR" -w '%{http_code}' --max-time 30 -X POST -H 'Content-Type: application/json' -d '{
"name":"Buryan Hub",
"hostname":"192.168.1.117","port":8989,"useSsl":false,"urlBase":"",
"apiKey":"'$(cat /root/.sonarr-key)'",
"activeProfileId":1,"activeProfileName":"Any","activeDirectory":"/tv",
"activeLanguageProfileId":1,
"activeAnimeProfileId":null,"activeAnimeProfileName":null,"activeAnimeDirectory":null,
"activeAnimeLanguageProfileId":null,
"activeTags":[],"activeAnimeTags":[],
"is4k":false,"isDefault":true,"syncEnabled":true,"preventSearch":false,
"enableSeasonFolders":true
}' "$S/settings/sonarr")
echo " ответ: HTTP $CODE $(head -c 200 /tmp/s4.out | tr -d '\n')"
echo
echo "=== RADARR ==="
CODE=$(curl -s -o /tmp/s5.out -b "$JAR" -w '%{http_code}' --max-time 30 -X POST -H 'Content-Type: application/json' -d '{
"name":"Buryan Hub",
"hostname":"192.168.1.118","port":7878,"useSsl":false,"urlBase":"",
"apiKey":"'$(cat /root/.radarr-key)'",
"activeProfileId":1,"activeProfileName":"Any","activeDirectory":"/movies",
"activeLanguageProfileId":1,"minimumAvailability":"released",
"activeTags":[],"tags":[],
"is4k":false,"isDefault":true,"syncEnabled":true,"preventSearch":false
}' "$S/settings/radarr")
echo " ответ: HTTP $CODE $(head -c 200 /tmp/s5.out | tr -d '\n')"
echo
echo "=== ЧТО ПОДКЛЮЧИЛОСЬ ==="
for e in sonarr radarr; do
printf ' %-8s ' "$e"
curl -s --max-time 15 -b "$JAR" "$S/settings/$e" 2>/dev/null \
| python3 -c "
import json,sys
try:
d=json.load(sys.stdin)
opts=d.get('options') or []
for o in opts:
print(f\"{o.get('hostname')}:{o.get('port')} профиль={o.get('activeProfileName')} папка={o.get('activeDirectory')} 4k={o.get('is4k')} активен={o.get('isDefault')}\")
if not opts: print('нет серверов')
except Exception:
print('нет ответа')
" 2>/dev/null
done
echo
echo "=== ПРОВЕРКА СВЯЗИ С СЕРВИСАМИ ==="
printf ' sonarr тест: '; curl -s -o /dev/null -w '%{http_code}\n' --max-time 15 -b "$JAR" -X POST "$S/settings/sonarr/test" -H 'Content-Type: application/json' -d '{"hostname":"192.168.1.117","port":8989,"useSsl":false,"urlBase":"","apiKey":"'$(cat /root/.sonarr-key)'"}'
printf ' radarr тест: '; curl -s -o /dev/null -w '%{http_code}\n' --max-time 15 -b "$JAR" -X POST "$S/settings/radarr/test" -H 'Content-Type: application/json' -d '{"hostname":"192.168.1.118","port":7878,"useSsl":false,"urlBase":"","apiKey":"'$(cat /root/.radarr-key)'"}'