1.4 - new script interval, improved logging
This commit is contained in:
parent
1e769a8fa2
commit
1bcb90b17c
1 changed files with 30 additions and 9 deletions
|
@ -1,22 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
scriptVersion="1.3"
|
||||
scriptVersion="1.4"
|
||||
ytdlpExtraOpts="--user-agent facebookexternalhit/1.1"
|
||||
scriptName="YoutubeSeriesDownloader"
|
||||
|
||||
#### Import Settings
|
||||
source /config/extended.conf
|
||||
|
||||
log () {
|
||||
m_time=`date "+%F %T"`
|
||||
echo $m_time" :: $scriptName :: $scriptVersion :: "$1
|
||||
}
|
||||
|
||||
logfileSetup () {
|
||||
# auto-clean up log file to reduce space usage
|
||||
if [ -f "/config/logs/$scriptName.txt" ]; then
|
||||
find /config/logs -type f -name "$scriptName.txt" -size +1024k -delete
|
||||
fi
|
||||
|
||||
if [ ! -f "/config/logs/$scriptName.txt" ]; then
|
||||
touch "/config/logs/$scriptName.txt"
|
||||
chmod 666 "/config/logs/$scriptName.txt"
|
||||
fi
|
||||
exec &> >(tee -a "/config/logs/$scriptName.txt")
|
||||
}
|
||||
|
||||
verifyConfig () {
|
||||
#### Import Settings
|
||||
source /config/extended.conf
|
||||
|
||||
if [ "$enableYoutubeSeriesDownloader" != "true" ]; then
|
||||
log "Script is not enabled, enable by setting enableYoutubeSeriesDownloader to \"true\" by modifying the \"/config/extended.conf\" config file..."
|
||||
log "Sleeping (infinity)"
|
||||
sleep infinity
|
||||
fi
|
||||
|
||||
if [ -z "$youtubeSeriesDownloaderScriptInterval" ]; then
|
||||
youtubeSeriesDownloaderScriptInterval="1h"
|
||||
fi
|
||||
}
|
||||
|
||||
getArrAppInfo () {
|
||||
# Get Arr App information
|
||||
if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then
|
||||
|
@ -180,13 +199,15 @@ YoutubeSeriesDownloaderProcess () {
|
|||
done
|
||||
}
|
||||
|
||||
log "Starting Script...."
|
||||
for (( ; ; )); do
|
||||
let i++
|
||||
logfileSetup
|
||||
log "Script starting..."
|
||||
verifyConfig
|
||||
getArrAppInfo
|
||||
verifyApiAccess
|
||||
YoutubeSeriesDownloaderProcess
|
||||
log "Script sleeping for 2 hours..."
|
||||
sleep 2h
|
||||
log "Script sleeping for $youtubeSeriesDownloaderScriptInterval..."
|
||||
sleep $youtubeSeriesDownloaderScriptInterval
|
||||
done
|
||||
exit
|
||||
|
|
Loading…
Reference in a new issue