From cc94e8483886c5957cf818633f347ff25322b68d Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Wed, 12 Jul 2023 11:14:14 +0000 Subject: [PATCH] Update YoutubeSeriesDownloader.service --- sonarr/YoutubeSeriesDownloader.service | 43 +++++++++++++------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/sonarr/YoutubeSeriesDownloader.service b/sonarr/YoutubeSeriesDownloader.service index 4de29e2..eb00b3d 100644 --- a/sonarr/YoutubeSeriesDownloader.service +++ b/sonarr/YoutubeSeriesDownloader.service @@ -1,10 +1,22 @@ #!/usr/bin/env bash scriptVersion="1.2" 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 +} + +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 + getArrAppInfo () { # Get Arr App information if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then @@ -41,12 +53,6 @@ verifyApiAccess () { done } - -log () { - m_time=`date "+%F %T"` - echo $m_time" :: Youtube Series Downloader :: $scriptVersion :: "$1 -} - # auto-clean up log file to reduce space usage if [ -f "/config/logs/YoutubeSeriesDownloader.txt" ]; then find /config/logs -type f -name "YoutubeSeriesDownloader.txt" -size +1024k -delete @@ -174,20 +180,13 @@ YoutubeSeriesDownloaderProcess () { done } -if [ "$enableYoutubeSeriesDownloader" == "true" ]; then - log "Starting Script...." - for (( ; ; )); do - let i++ - getArrAppInfo - verifyApiAccess - YoutubeSeriesDownloaderProcess - log "Script sleeping for 2 hours..." - sleep 2h - done -else - 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 - +log "Starting Script...." +for (( ; ; )); do + let i++ + getArrAppInfo + verifyApiAccess + YoutubeSeriesDownloaderProcess + log "Script sleeping for 2 hours..." + sleep 2h +done exit