From f417518171328e82802a1707a44febdea1acbd33 Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Tue, 13 Feb 2024 22:43:38 -0500 Subject: [PATCH 1/4] v1.5 - Python script appends current log --- lidarr/python/ARLChecker.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lidarr/python/ARLChecker.py b/lidarr/python/ARLChecker.py index 2c0b314..71353a3 100644 --- a/lidarr/python/ARLChecker.py +++ b/lidarr/python/ARLChecker.py @@ -17,12 +17,17 @@ with open("/custom-services.d/ARLChecker", "r") as r: if 'scriptVersion' in line: VERSION = re.search(r'"([A-Za-z0-9_\./\\-]*)"', line)[0].replace('"','') +# Get current log file +path = '\config\logs' +latest_file = max([os.path.join(path, f) for f in os.listdir(path) if 'ARLChecker' in f],key=os.path.getctime) # Logging Setup logging.basicConfig( format=f'%(asctime)s :: ARLChecker :: {VERSION} :: %(levelname)s :: %(message)s', datefmt='%Y-%m-%d %H:%M:%S', - level=logging.INFO + level=logging.INFO, + filename=latest_file, + filemode='a' ) logger = logging.getLogger(__name__) From f0fbf9b775ed17f336195c5b383ec8176a46138b Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Tue, 13 Feb 2024 22:55:06 -0500 Subject: [PATCH 2/4] v1.5 - Python script appends current log --- lidarr/python/ARLChecker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lidarr/python/ARLChecker.py b/lidarr/python/ARLChecker.py index 71353a3..d747c94 100644 --- a/lidarr/python/ARLChecker.py +++ b/lidarr/python/ARLChecker.py @@ -18,7 +18,7 @@ with open("/custom-services.d/ARLChecker", "r") as r: VERSION = re.search(r'"([A-Za-z0-9_\./\\-]*)"', line)[0].replace('"','') # Get current log file -path = '\config\logs' +path = '/config/logs' latest_file = max([os.path.join(path, f) for f in os.listdir(path) if 'ARLChecker' in f],key=os.path.getctime) # Logging Setup From 965c90def341ba0d0f88757ac7fbbaa0d42235ea Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Tue, 13 Feb 2024 23:06:59 -0500 Subject: [PATCH 3/4] v1.5 - Python script appends current log --- lidarr/python/ARLChecker.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lidarr/python/ARLChecker.py b/lidarr/python/ARLChecker.py index d747c94..9625a9b 100644 --- a/lidarr/python/ARLChecker.py +++ b/lidarr/python/ARLChecker.py @@ -3,7 +3,7 @@ from pathlib import Path from dataclasses import dataclass from requests import Session from argparse import ArgumentParser -from sys import argv +from sys import argv, stdout from colorama import Fore, init from telegram import Update from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler @@ -26,8 +26,10 @@ logging.basicConfig( format=f'%(asctime)s :: ARLChecker :: {VERSION} :: %(levelname)s :: %(message)s', datefmt='%Y-%m-%d %H:%M:%S', level=logging.INFO, - filename=latest_file, - filemode='a' + handlers=[ + logging.StreamHandler(stdout), + logging.FileHandler(latest_file, mode="a") + ] ) logger = logging.getLogger(__name__) From b423b9f69150962c161a7ada6bad653ecc8ab697 Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Tue, 13 Feb 2024 23:14:48 -0500 Subject: [PATCH 4/4] v1.5 - Python script now appends text log --- lidarr/ARLChecker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lidarr/ARLChecker b/lidarr/ARLChecker index 255817a..1028f84 100644 --- a/lidarr/ARLChecker +++ b/lidarr/ARLChecker @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash ### Default values -scriptVersion="1.4" +scriptVersion="1.5" scriptName="ARLChecker" sleepInterval='24h' ### Import Settings