@ -1,5 +1,5 @@
#!/usr/bin/env bash
scriptVersion = "1.0.00 4 "
scriptVersion = "1.0.00 5 "
if [ -z " $arrUrl " ] || [ -z " $arrApiKey " ] ; then
arrUrlBase = " $( cat /config/config.xml | xq | jq -r .Config.UrlBase) "
@ -31,15 +31,28 @@ arrQueueIds=$(echo "$arrQueueData" | jq -r 'select(.status=="completed") | selec
arrQueueIdsCount = $( echo " $arrQueueData " | jq -r 'select(.status=="completed") | select(.trackedDownloadStatus=="warning") | .id' | wc -l)
if [ $arrQueueIdsCount -eq 0 ] ; then
log "No items in queue to clean up..."
exit
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... "
curl -sX DELETE " $arrUrl /api/v3/queue/ $queueId ?removeFromClient=true&blocklist=true&apikey= ${ arrApiKey } "
done
fi
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... "
curl -sX DELETE " $arrUrl /api/v3/queue/ $queueId ?removeFromClient=true&blocklist=true&apikey= ${ arrApiKey } "
done
arrQueueData = " $( curl -s " $arrUrl /api/v3/queue?page=1&pagesize=1000000000&sortDirection=descending&sortKey=progress&includeUnknownMovieItems=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
log "No items in queue to clean up..."
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... "
curl -sX DELETE " $arrUrl /api/v3/queue/ $queueId ?removeFromClient=true&blocklist=true&apikey= ${ arrApiKey } "
done
fi
exit