parent
242a736051
commit
ec40f86dbb
1 changed files with 33 additions and 23 deletions
|
@ -1,20 +1,40 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
scriptVersion="1.2"
|
scriptVersion="1.3"
|
||||||
scriptName="AutoExtras"
|
scriptName="AutoExtras"
|
||||||
|
|
||||||
#### Import Settings
|
|
||||||
source /config/extended.conf
|
|
||||||
|
|
||||||
log () {
|
log () {
|
||||||
m_time=`date "+%F %T"`
|
m_time=`date "+%F %T"`
|
||||||
echo $m_time" :: $scriptName :: $scriptVersion :: "$1
|
echo $m_time" :: $scriptName :: $scriptVersion :: "$1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$enableExtras" != "true" ]; then
|
logfileSetup () {
|
||||||
|
# auto-clean up log file to reduce space usage
|
||||||
|
if [ -f "/config/logs/AutoExtras.txt" ]; then
|
||||||
|
find /config/logs -type f -name "QueueCleaner.txt" -size +1024k -delete
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "/config/logs/AutoExtras.txt" ]; then
|
||||||
|
touch "/config/logs/AutoExtras.txt"
|
||||||
|
chmod 666 "/config/logs/AutoExtras.txt"
|
||||||
|
fi
|
||||||
|
exec &> >(tee -a "/config/logs/AutoExtras.txt")
|
||||||
|
}
|
||||||
|
|
||||||
|
verifyConfig () {
|
||||||
|
#### Import Settings
|
||||||
|
source /config/extended.conf
|
||||||
|
|
||||||
|
if [ "$enableExtras" != "true" ]; then
|
||||||
log "Script is not enabled, enable by setting enableExtras to \"true\" by modifying the \"/config/extended.conf\" config file..."
|
log "Script is not enabled, enable by setting enableExtras to \"true\" by modifying the \"/config/extended.conf\" config file..."
|
||||||
log "Sleeping (infinity)"
|
log "Sleeping (infinity)"
|
||||||
sleep infinity
|
sleep infinity
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$autoExtrasScriptInterval" ]; then
|
||||||
|
autoExtrasScriptInterval="24h"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
getArrAppInfo () {
|
getArrAppInfo () {
|
||||||
# Get Arr App information
|
# Get Arr App information
|
||||||
|
@ -54,17 +74,6 @@ verifyApiAccess () {
|
||||||
|
|
||||||
AutoExtrasProcess () {
|
AutoExtrasProcess () {
|
||||||
|
|
||||||
# auto-clean up log file to reduce space usage
|
|
||||||
if [ -f "/config/logs/AutoExtras.txt" ]; then
|
|
||||||
find /config/logs -type f -name "AutoExtras.txt" -size +1024k -delete
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "/config/logs/AutoExtras.txt" ]; then
|
|
||||||
touch "/config/logs/AutoExtras.txt"
|
|
||||||
chmod 777 "/config/logs/AutoExtras.txt"
|
|
||||||
fi
|
|
||||||
exec &> >(tee -a "/config/logs/AutoExtras.txt")
|
|
||||||
|
|
||||||
radarrMovieList=$(curl -s --header "X-Api-Key:"${arrApiKey} --request GET "$arrUrl/api/v3/movie")
|
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)
|
radarrMovieTotal=$(echo "${radarrMovieList}" | jq -r '.[] | select(.hasFile==true) | .id' | wc -l)
|
||||||
radarrMovieIds=$(echo "${radarrMovieList}" | jq -r '.[] | select(.hasFile==true) | .id')
|
radarrMovieIds=$(echo "${radarrMovieList}" | jq -r '.[] | select(.hasFile==true) | .id')
|
||||||
|
@ -78,14 +87,15 @@ AutoExtrasProcess () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log "Starting Script...."
|
|
||||||
for (( ; ; )); do
|
for (( ; ; )); do
|
||||||
let i++
|
let i++
|
||||||
|
logfileSetup
|
||||||
|
verifyConfig
|
||||||
getArrAppInfo
|
getArrAppInfo
|
||||||
verifyApiAccess
|
verifyApiAccess
|
||||||
AutoExtrasProcess
|
AutoExtrasProcess
|
||||||
log "Script sleeping for 24 hours..."
|
log "Script sleeping for $autoExtrasScriptInterval..."
|
||||||
sleep 24h
|
sleep $autoExtrasScriptInterval
|
||||||
done
|
done
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Reference in a new issue