Skip to content

Instantly share code, notes, and snippets.

@Fronix
Created August 4, 2021 12:40
Show Gist options
  • Save Fronix/4b3cddbc97a56d75f7f6d3b1a50f6a75 to your computer and use it in GitHub Desktop.
Save Fronix/4b3cddbc97a56d75f7f6d3b1a50f6a75 to your computer and use it in GitHub Desktop.
Delete unmonitored radarr movies added before X date
#!/bin/sh
HOST=http://local.radarr
API_KEY=
# Add your min date here
# All movies added before this date gets deleted
date=$(date "+%s" -d "2020-04-01")
ids=$(curl --silent $HOST/api/v3/movie -X GET -H "X-Api-Key: $API_KEY" \ |
jq '[.[] | select ((.monitored == false) and (.added | fromdateiso8601 < '"$date"')) | .id'])
length=$( echo "{\"ids\": $ids}" | jq '.ids | length')
echo "Deleting $length movies"
# Uncomment this to trigger deletion. Be careful
#curl -X DELETE "$HOST/api/v3/movie/editor" -H "accept: */*" -H "Content-Type: application/json" -H "X-Api-Key: $API_KEY" -d "{\"movieIds\":"$ids",\"deleteFIles\":false,\"addImportExclusion\":false}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment