From 5afd750c76b071a7aef532799531bcc0f97102e8 Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Mon, 12 Feb 2024 21:17:54 -0500 Subject: [PATCH 1/7] Pull version from script, rather than define in .py --- lidarr/ARLChecker | 2 +- lidarr/python/ARLChecker.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lidarr/ARLChecker b/lidarr/ARLChecker index 962c7ea..969944b 100644 --- a/lidarr/ARLChecker +++ b/lidarr/ARLChecker @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash ### Default values -scriptVersion="1.3" +scriptVersion="1.4.0" scriptName="ARLChecker" sleepInterval='24h' ### Import Settings diff --git a/lidarr/python/ARLChecker.py b/lidarr/python/ARLChecker.py index 48b6c5c..4485b20 100644 --- a/lidarr/python/ARLChecker.py +++ b/lidarr/python/ARLChecker.py @@ -11,8 +11,13 @@ import logging import os from datetime import datetime +# Pull script version from previous +VERSION = '0.0.0' +with open(os.path.join(os.pardir, "ARLChecker"), "r") as r: + for line in r: + if 'scriptVersion' in line: + VERSION = re.search(r'"([A-Za-z0-9_\./\\-]*)"', line)[0].replace('"','') -VERSION = 0.1 # Logging Setup logging.basicConfig( From 13a5bccc001b4f24ad46bc56adbd814cd73b8f04 Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Mon, 12 Feb 2024 21:49:13 -0500 Subject: [PATCH 2/7] Set script version-lookup path to match docker structure. --- 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 4485b20..2f0d84b 100644 --- a/lidarr/python/ARLChecker.py +++ b/lidarr/python/ARLChecker.py @@ -13,7 +13,7 @@ from datetime import datetime # Pull script version from previous VERSION = '0.0.0' -with open(os.path.join(os.pardir, "ARLChecker"), "r") as r: +with open("./custom-services.d/ARLChecker", "r") as r: for line in r: if 'scriptVersion' in line: VERSION = re.search(r'"([A-Za-z0-9_\./\\-]*)"', line)[0].replace('"','') From 4e96a479622e189d394079d948fee22b1316a96a Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Mon, 12 Feb 2024 21:51:23 -0500 Subject: [PATCH 3/7] Set script version-lookup path to match docker structure. --- 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 2f0d84b..a34eb35 100644 --- a/lidarr/python/ARLChecker.py +++ b/lidarr/python/ARLChecker.py @@ -13,7 +13,7 @@ from datetime import datetime # Pull script version from previous VERSION = '0.0.0' -with open("./custom-services.d/ARLChecker", "r") as r: +with open("/custom-services.d/ARLChecker", "r") as r: for line in r: if 'scriptVersion' in line: VERSION = re.search(r'"([A-Za-z0-9_\./\\-]*)"', line)[0].replace('"','') From d477614c52f890b06c859a2795390e4803461976 Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Tue, 13 Feb 2024 09:14:34 -0500 Subject: [PATCH 4/7] v1.4 - Python script shows correct version --- lidarr/ARLChecker | 2 +- lidarr/python/ARLChecker.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lidarr/ARLChecker b/lidarr/ARLChecker index 969944b..255817a 100644 --- a/lidarr/ARLChecker +++ b/lidarr/ARLChecker @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash ### Default values -scriptVersion="1.4.0" +scriptVersion="1.4" scriptName="ARLChecker" sleepInterval='24h' ### Import Settings diff --git a/lidarr/python/ARLChecker.py b/lidarr/python/ARLChecker.py index a34eb35..160e80e 100644 --- a/lidarr/python/ARLChecker.py +++ b/lidarr/python/ARLChecker.py @@ -11,8 +11,7 @@ import logging import os from datetime import datetime -# Pull script version from previous -VERSION = '0.0.0' +# Pull script version from bash script. will likely change this to a var passthrough with open("/custom-services.d/ARLChecker", "r") as r: for line in r: if 'scriptVersion' in line: From e942ba02dcc09815b12b96731e0d1599d445706f Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Tue, 13 Feb 2024 09:21:33 -0500 Subject: [PATCH 5/7] v1.4 - Python script shows correct version --- lidarr/ARLChecker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lidarr/ARLChecker b/lidarr/ARLChecker index 255817a..969944b 100644 --- a/lidarr/ARLChecker +++ b/lidarr/ARLChecker @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash ### Default values -scriptVersion="1.4" +scriptVersion="1.4.0" scriptName="ARLChecker" sleepInterval='24h' ### Import Settings From 106e620a7ace1535debb79288f3448b918d86bcc Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Tue, 13 Feb 2024 09:25:57 -0500 Subject: [PATCH 6/7] v1.4 - Python script shows correct version --- lidarr/ARLChecker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lidarr/ARLChecker b/lidarr/ARLChecker index 969944b..255817a 100644 --- a/lidarr/ARLChecker +++ b/lidarr/ARLChecker @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash ### Default values -scriptVersion="1.4.0" +scriptVersion="1.4" scriptName="ARLChecker" sleepInterval='24h' ### Import Settings From d60015a0502427e078617b49a94290f86eacdb78 Mon Sep 17 00:00:00 2001 From: hockeygoalie35 Date: Tue, 13 Feb 2024 09:34:17 -0500 Subject: [PATCH 7/7] v1.4 - Python script shows correct version --- lidarr/python/ARLChecker.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lidarr/python/ARLChecker.py b/lidarr/python/ARLChecker.py index 160e80e..2c0b314 100644 --- a/lidarr/python/ARLChecker.py +++ b/lidarr/python/ARLChecker.py @@ -90,7 +90,7 @@ class DeezerPlatformProvider: ) res.raise_for_status() except Exception as error: - logger.error(Fore.RED + 'Could not connect! Service down, API changed, wrong credentials or code-related issue.' + Fore.WHITE) + logger.error(Fore.RED + 'Could not connect! Service down, API changed, wrong credentials or code-related issue.' + Fore.LIGHTWHITE_EX) raise ConnectionError() self.session.cookies.clear() @@ -98,17 +98,17 @@ class DeezerPlatformProvider: try: res = res.json() except Exception as error: - logger.error(Fore.RED + "Could not parse JSON response from DEEZER!" + Fore.WHITE) + logger.error(Fore.RED + "Could not parse JSON response from DEEZER!" + Fore.LIGHTWHITE_EX) raise ParseError() if 'error' in res and res['error']: - logger.error(Fore.RED + "Deezer returned the following error:{}".format(res["error"]) + Fore.WHITE) + logger.error(Fore.RED + "Deezer returned the following error:{}".format(res["error"]) + Fore.LIGHTWHITE_EX) raise ServiceError() res = res['results'] if res['USER']['USER_ID'] == 0: - logger.error(Fore.RED+"ARL Token Expired. Update the token in extended.conf"+Fore.WHITE) + logger.error(Fore.RED+"ARL Token Expired. Update the token in extended.conf"+Fore.LIGHTWHITE_EX) raise AuthError() return Account(username, secret, res['COUNTRY'], Plan( @@ -203,7 +203,7 @@ class LidarrExtendedAPI: def check_token(self, token=None): logger.info('Checking ARL Token Validity...') if token == '""': - logger.info(Fore.YELLOW+"No ARL Token set in Extended.conf"+Fore.WHITE) + logger.info(Fore.YELLOW+"No ARL Token set in Extended.conf"+Fore.LIGHTWHITE_EX) self.report_status("NOT SET") exit(0) if token is None: @@ -213,14 +213,14 @@ class LidarrExtendedAPI: deezer_check = DeezerPlatformProvider() account = deezer_check.login('', token.replace('"','')) if account.plan: - logger.info(Fore.GREEN + f'Deezer Account Found.'+ Fore.WHITE) + logger.info(Fore.GREEN + f'Deezer Account Found.'+ Fore.LIGHTWHITE_EX) logger.info('-------------------------------') logger.info(f'Plan: {account.plan.name}') logger.info(f'Expiration: {account.plan.expires}') - logger.info(f'Active: {Fore.GREEN+"Y" if account.plan.active else "N"}'+Fore.WHITE) - logger.info(f'Download: {Fore.GREEN+"Y" if account.plan.download else Fore.RED+"N"}'+Fore.WHITE) - logger.info(f'Lossless: {Fore.GREEN+"Y" if account.plan.lossless else Fore.RED+"N"}'+Fore.WHITE) - logger.info(f'Explicit: {Fore.GREEN+"Y" if account.plan.explicit else Fore.RED+"N"}'+Fore.WHITE) + logger.info(f'Active: {Fore.GREEN+"Y" if account.plan.active else "N"}'+Fore.LIGHTWHITE_EX) + logger.info(f'Download: {Fore.GREEN+"Y" if account.plan.download else Fore.RED+"N"}'+Fore.LIGHTWHITE_EX) + logger.info(f'Lossless: {Fore.GREEN+"Y" if account.plan.lossless else Fore.RED+"N"}'+Fore.LIGHTWHITE_EX) + logger.info(f'Explicit: {Fore.GREEN+"Y" if account.plan.explicit else Fore.RED+"N"}'+Fore.LIGHTWHITE_EX) logger.info('-------------------------------') self.report_status('VALID') return True @@ -357,9 +357,9 @@ def main(arlToken = None): arlToken_instance.check_token(arlToken_instance.arlToken) except Exception as e: if 'Chat not found' in str(e): - logger.error(Fore.RED + "Chat not found. Check your chat ID in extended.conf, or start a chat with your bot."+Fore.WHITE) + logger.error(Fore.RED + "Chat not found. Check your chat ID in extended.conf, or start a chat with your bot."+Fore.LIGHTWHITE_EX) elif 'The token' in str(e): - logger.error(Fore.RED + "Check your Bot Token in extended.conf."+Fore.WHITE) + logger.error(Fore.RED + "Check your Bot Token in extended.conf."+Fore.LIGHTWHITE_EX) else: print(e) exit(1)