Created
January 2, 2019 17:01
-
-
Save ajkis/cefe059eba6f13ea2c9d924c22069bc7 to your computer and use it in GitHub Desktop.
This file contains 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/bash | |
RadarrDB="/home/plex/.config/Radarr/nzbdrone.db" | |
Url="http://XXX.XXX.XXX.XXX:7878" | |
ApiKey="XXXX" | |
Counter=0 | |
readarray -t MOVIES < <(sqlite3 "$RadarrDB" "SELECT id from Movies WHERE MovieFileId NOT IN (SELECT id FROM MovieFiles)") | |
echo "Deleting missing Movies where Year is older then X" | |
for movieid in "${MOVIES[@]}" | |
do | |
Counter=$(($Counter +1 )) | |
echo "Processing: $(sqlite3 "$RadarrDB" "SELECT id, title, Year from Movies WHERE id = '$movieid'")" | |
curl {$Url}/api/movie/$movieid -X DELETE -H "X-Api-Key: $ApiKey" | |
done | |
echo "Processed $Counter movies" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wrong echo
echo "Deleting missing Movies where Year is older then X"
right one
echo "Deleting all wanted & missing movies"