v1.0.001 - Adjusted for Sonarr

pull/1/head
RandomNinjaAtk 2 years ago committed by GitHub
parent 578ab6532f
commit 44337f0307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
#!/usr/bin/env bash
scriptVersion="1.0.000"
scriptVersion="1.0.001"
if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then
arrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
@ -26,7 +26,7 @@ log () {
echo $m_time" :: QueueCleaner :: "$1
}
arrQueueData="$(curl -s "$arrUrl/api/v3/queue?page=1&pagesize=1000000000&sortDirection=descending&sortKey=progress&includeUnknownMovieItems=true&apikey=${arrApiKey}" | jq -r .records[])"
arrQueueData="$(curl -s "$arrUrl/api/v3/queue?page=1&pagesize=1000000000&sortDirection=descending&sortKey=progress&includeUnknownSeriesItems=true&apikey=${arrApiKey}" | jq -r .records[])"
arrQueueIds=$(echo "$arrQueueData" | jq -r 'select(.status=="completed") | select(.trackedDownloadStatus=="warning") | .id')
arrQueueIdsCount=$(echo "$arrQueueData" | jq -r 'select(.status=="completed") | select(.trackedDownloadStatus=="warning") | .id' | wc -l)
if [ $arrQueueIdsCount -eq 0 ]; then
@ -35,12 +35,12 @@ else
for queueId in $(echo $arrQueueIds); do
arrQueueItemData="$(echo "$arrQueueData" | jq -r "select(.id==$queueId)")"
arrQueueItemTitle="$(echo "$arrQueueItemData" | jq -r .title)"
log "Removing Failed Queue Item ID: $queueId ($arrQueueItemTitle) from Radarr..."
log "Removing Failed Queue Item ID: $queueId ($arrQueueItemTitle) from Sonarr..."
curl -sX DELETE "$arrUrl/api/v3/queue/$queueId?removeFromClient=true&blocklist=true&apikey=${arrApiKey}"
done
fi
arrQueueData="$(curl -s "$arrUrl/api/v3/queue?page=1&pagesize=1000000000&sortDirection=descending&sortKey=progress&includeUnknownMovieItems=true&apikey=${arrApiKey}" | jq -r .records[])"
arrQueueData="$(curl -s "$arrUrl/api/v3/queue?page=1&pagesize=1000000000&sortDirection=descending&sortKey=progress&includeUnknownSeriesItems=true&apikey=${arrApiKey}" | jq -r .records[])"
arrQueueIds=$(echo "$arrQueueData" | jq -r 'select(.status=="failed") | select(.trackedDownloadStatus=="warning") | .id')
arrQueueIdsCount=$(echo "$arrQueueData" | jq -r 'select(.status=="failed") | select(.trackedDownloadStatus=="warning") | .id' | wc -l)
if [ $arrQueueIdsCount -eq 0 ]; then
@ -50,7 +50,7 @@ else
for queueId in $(echo $arrQueueIds); do
arrQueueItemData="$(echo "$arrQueueData" | jq -r "select(.id==$queueId)")"
arrQueueItemTitle="$(echo "$arrQueueItemData" | jq -r .title)"
log "Removing Failed Queue Item ID: $queueId ($arrQueueItemTitle) from Radarr..."
log "Removing Failed Queue Item ID: $queueId ($arrQueueItemTitle) from Sonarr..."
curl -sX DELETE "$arrUrl/api/v3/queue/$queueId?removeFromClient=true&blocklist=true&apikey=${arrApiKey}"
done
fi

Loading…
Cancel
Save