diff --git a/root/scripts/InvalidSeriesAutoCleaner.bash b/root/scripts/InvalidSeriesAutoCleaner.bash index 88bb77d..08a15a9 100644 --- a/root/scripts/InvalidSeriesAutoCleaner.bash +++ b/root/scripts/InvalidSeriesAutoCleaner.bash @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.001" +scriptVersion="1.0.002" if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then arrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" @@ -29,6 +29,11 @@ log () { # Get invalid series tvdb id's seriesTvdbId="$(curl -s --header "X-Api-Key:"$arrApiKey --request GET "$arrUrl/api/v3/health" | jq -r '.[] | select(.source=="RemovedSeriesCheck") | select(.type=="error")' | grep "message" | grep -o '[[:digit:]]*')" +if [ -z "$seriesTvdbId" ]; then + log "No invalid tvdbid's reported by Sonarr health check, skipping..." + exit +fi + # Process each invalid series tvdb id for tvdbId in $(echo $seriesTvdbId); do seriesData="$(curl -s --header "X-Api-Key:"$arrApiKey --request GET "$arrUrl/api/v3/series" | jq -r ".[] | select(.tvdbId==$tvdbId)")"