From 7173e0fb495062b742645c6020f366518e48d7b8 Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 24 Feb 2025 14:25:35 +0000 Subject: [PATCH] first script to add all the indexers --- prowlarr_add_bulk_indexer.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 prowlarr_add_bulk_indexer.sh diff --git a/prowlarr_add_bulk_indexer.sh b/prowlarr_add_bulk_indexer.sh new file mode 100755 index 0000000..2071e5e --- /dev/null +++ b/prowlarr_add_bulk_indexer.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Base URL and API key +BASE_URL="https://prowlarr.tryton.geeraert.eu" +API_KEY="0cb77d794ab74f158daaae044ab850ee" + +APP_PROFILE_ID=1 # Set this to a valid App Profile Id + +# Get the list of all available indexers +available_indexers=$(curl -s -X GET "$BASE_URL/api/v1/indexer/schema" \ + -H "accept: application/json" \ + -H "X-Api-Key: $API_KEY") + +# Loop through each indexer and add it to Prowlarr +echo "$available_indexers" | jq -c '.[]' | while read -r indexer; do + indexer_name=$(echo "$indexer" | jq -r '.name') + indexer_settings=$(echo "$indexer" | jq -c '.') + + # Add the AppProfileId to the indexer settings + indexer_settings=$(echo "$indexer_settings" | jq --argjson appProfileId "$APP_PROFILE_ID" '. + {AppProfileId: $appProfileId}') + + echo "Adding indexer: $indexer_name" + + curl -s -X POST "$BASE_URL/api/v1/indexer" \ + -H "accept: application/json" \ + -H "X-Api-Key: $API_KEY" \ + -H "Content-Type: application/json" \ + -d "$indexer_settings" + + echo "Indexer $indexer_name added." +done