Created
August 4, 2021 12:40
-
-
Save Fronix/4b3cddbc97a56d75f7f6d3b1a50f6a75 to your computer and use it in GitHub Desktop.
Delete unmonitored radarr movies added before X date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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