forked from ultimate-pms/ultimate-media-server-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
radarr_cleanup-crappy-movies.sh
executable file
·53 lines (41 loc) · 1.74 KB
/
radarr_cleanup-crappy-movies.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# I stupidly added in a list to Radarr that imported thousands of low ranking movies that I didn't want ....
# This is a quick and dirty script to find those movies on the NAS (volume #6) and blow them away if they have not yet been downloaded ...
#
# Author: DN
# https://github.com/ultimate-pms/ultimate-plex-setup
#
################################################################################################
RADARR_API_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
RADARR_HOST="127.0.0.1"
RADARR_PORT="7878"
ONLY_MATCH_PATH="/nas/bay-6/"
################################################################################################
TOTALITEMS=`curl -s -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-Key: $RADARR_API_KEY" \
-X GET http://$RADARR_HOST:$RADARR_PORT/api/movie`
i=0
for row in $(echo "${TOTALITEMS}" | jq -r '.[] | @base64'); do
_jq() {
echo ${row} | /usr/bin/base64 --decode | /usr/bin/jq -r ${1}
}
i=$((i + 1))
MOVIENAME=`echo $(_jq '.title')`
DOWNLOADED=`echo $(_jq '.downloaded')`
PATH=`echo $(_jq '.path')`
ID=`echo $(_jq '.id')`
echo "#$i [ID: $ID] - $MOVIENAME"
if [ "$DOWNLOADED" == "false" ]; then
echo -e "\n>> Movie [$MOVIENAME] not downloaded... Is this in $ONLY_MATCH_PATH?"
if [[ $PATH = *"$ONLY_MATCH_PATH"* ]]; then
echo ">> Movie was in $ONLY_MATCH_PATH ... Blow it away!"
/usr/bin/curl -s -H "Accept: application/json" \
-H "Content-Type: application/json" \
--data "content=success" \
-H "X-Api-Key: $RADARR_API_KEY" \
-X DELETE http://$RADARR_HOST:$RADARR_PORT/api/movie/$ID
echo -e ">> REMOVED!\n"
fi
fi
done