1.2 - univ functions
This commit is contained in:
parent
a5673851a4
commit
0f96d50dad
1 changed files with 8 additions and 31 deletions
|
@ -1,14 +1,16 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
scriptVersion="1.1"
|
scriptVersion="1.2"
|
||||||
scriptName="DailySeriesEpisodeTrimmer"
|
scriptName="DailySeriesEpisodeTrimmer"
|
||||||
|
|
||||||
#### Import Settings
|
#### Import Settings
|
||||||
source /config/extended.conf
|
source /config/extended.conf
|
||||||
|
#### Import Functions
|
||||||
log () {
|
source /config/extended/functions
|
||||||
m_time=`date "+%F %T"`
|
#### Create Log File
|
||||||
echo $m_time" :: $scriptName :: $scriptVersion :: "$1
|
logfileSetup
|
||||||
}
|
#### Check Arr App
|
||||||
|
getArrAppInfo
|
||||||
|
verifyApiAccess
|
||||||
|
|
||||||
if [ "$enableDailySeriesEpisodeTrimmer" != "true" ]; then
|
if [ "$enableDailySeriesEpisodeTrimmer" != "true" ]; then
|
||||||
log "Script is not enabled, enable by setting enableDailySeriesEpisodeTrimmer to \"true\" by modifying the \"/config/extended.conf\" config file..."
|
log "Script is not enabled, enable by setting enableDailySeriesEpisodeTrimmer to \"true\" by modifying the \"/config/extended.conf\" config file..."
|
||||||
|
@ -16,31 +18,6 @@ if [ "$enableDailySeriesEpisodeTrimmer" != "true" ]; then
|
||||||
sleep infinity
|
sleep infinity
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then
|
|
||||||
arrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
|
|
||||||
if [ "$arrUrlBase" == "null" ]; then
|
|
||||||
arrUrlBase=""
|
|
||||||
else
|
|
||||||
arrUrlBase="/$(echo "$arrUrlBase" | sed "s/\///g")"
|
|
||||||
fi
|
|
||||||
arrApiKey="$(cat /config/config.xml | xq | jq -r .Config.ApiKey)"
|
|
||||||
arrPort="$(cat /config/config.xml | xq | jq -r .Config.Port)"
|
|
||||||
arrUrl="http://127.0.0.1:${arrPort}${arrUrlBase}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# auto-clean up log file to reduce space usage
|
|
||||||
if [ -f "/config/logs/DailySeriesEpisodeTrimmer.txt" ]; then
|
|
||||||
find /config/logs -type f -name "DailySeriesEpisodeTrimmer.txt" -size +1024k -delete
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "/config/logs/DailySeriesEpisodeTrimmer.txt" ]; then
|
|
||||||
touch "/config/logs/DailySeriesEpisodeTrimmer.txt"
|
|
||||||
chmod 666 "/config/logs/DailySeriesEpisodeTrimmer.txt"
|
|
||||||
fi
|
|
||||||
exec &> >(tee -a "/config/logs/DailySeriesEpisodeTrimmer.txt")
|
|
||||||
|
|
||||||
if [ "$sonarr_eventtype" == "Test" ]; then
|
if [ "$sonarr_eventtype" == "Test" ]; then
|
||||||
log "Tested"
|
log "Tested"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue