#!/usr/bin/env bash # Register dev/fake-indexer.py as an indexer in the dev Radarr and Sonarr (idempotent). # Start the fake indexer first: python3 dev/fake-indexer.py set -euo pipefail add() { # base key categories local base=$1 key=$2 cats=$3 if curl -sf -H "X-Api-Key: $key" "$base/api/v3/indexer" | grep -q '"name": "Fake indexer"'; then return 0; fi curl -sf -H "X-Api-Key: $key" -H 'Content-Type: application/json' "$base/api/v3/indexer" -d "{ \"name\":\"Fake indexer\",\"implementation\":\"Newznab\",\"configContract\":\"NewznabSettings\", \"enableRss\":true,\"enableAutomaticSearch\":true,\"enableInteractiveSearch\":true,\"protocol\":\"usenet\",\"priority\":25,\"tags\":[], \"fields\":[{\"name\":\"baseUrl\",\"value\":\"http://host.containers.internal:19292\"},{\"name\":\"apiPath\",\"value\":\"/api\"}, {\"name\":\"apiKey\",\"value\":\"dev\"},{\"name\":\"categories\",\"value\":$cats}]}" >/dev/null echo "added indexer to $base" } add http://127.0.0.1:17878 devradarrapikey00000000000000000 '[2000,2040,2045]' add http://127.0.0.1:18989 devsonarrapikey00000000000000000 '[5000,5040]'