2023-07-09 17:47:46 +02:00
|
|
|
#!/usr/bin/env bash
|
2023-07-20 13:05:45 +02:00
|
|
|
scriptVersion="1.5"
|
2023-07-12 14:47:29 +02:00
|
|
|
scriptName="AutoExtras"
|
|
|
|
|
2023-07-20 13:05:45 +02:00
|
|
|
#### Import Settings
|
|
|
|
source /config/extended.conf
|
|
|
|
#### Import Functions
|
|
|
|
source /config/extended/functions
|
|
|
|
#### Create Log File
|
2023-07-19 16:44:59 +02:00
|
|
|
logfileSetup
|
|
|
|
|
2023-07-15 21:44:39 +02:00
|
|
|
verifyConfig () {
|
|
|
|
|
|
|
|
if [ "$enableExtras" != "true" ]; then
|
|
|
|
log "Script is not enabled, enable by setting enableExtras to \"true\" by modifying the \"/config/extended.conf\" config file..."
|
|
|
|
log "Sleeping (infinity)"
|
|
|
|
sleep infinity
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$autoExtrasScriptInterval" ]; then
|
|
|
|
autoExtrasScriptInterval="24h"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-07-09 17:47:46 +02:00
|
|
|
AutoExtrasProcess () {
|
2023-07-09 17:57:17 +02:00
|
|
|
|
2023-07-09 17:47:46 +02:00
|
|
|
radarrMovieList=$(curl -s --header "X-Api-Key:"${arrApiKey} --request GET "$arrUrl/api/v3/movie")
|
|
|
|
radarrMovieTotal=$(echo "${radarrMovieList}" | jq -r '.[] | select(.hasFile==true) | .id' | wc -l)
|
|
|
|
radarrMovieIds=$(echo "${radarrMovieList}" | jq -r '.[] | select(.hasFile==true) | .id')
|
|
|
|
|
|
|
|
loopCount=0
|
|
|
|
for id in $(echo $radarrMovieIds); do
|
2023-07-09 17:50:03 +02:00
|
|
|
loopCount=$(( $loopCount + 1 ))
|
2023-07-09 17:55:27 +02:00
|
|
|
log "$loopCount of $radarrMovieTotal :: $id :: Processing with Extras.bash"
|
2023-07-09 17:57:17 +02:00
|
|
|
bash /config/extended/Extras.bash "$id"
|
2023-07-09 17:47:46 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (( ; ; )); do
|
2023-07-09 17:49:32 +02:00
|
|
|
let i++
|
2023-07-15 21:44:39 +02:00
|
|
|
logfileSetup
|
|
|
|
verifyConfig
|
2023-07-09 17:47:46 +02:00
|
|
|
getArrAppInfo
|
|
|
|
verifyApiAccess
|
2023-07-09 17:49:32 +02:00
|
|
|
AutoExtrasProcess
|
2023-07-15 21:44:39 +02:00
|
|
|
log "Script sleeping for $autoExtrasScriptInterval..."
|
|
|
|
sleep $autoExtrasScriptInterval
|
2023-07-09 17:47:46 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
exit
|