v1.4 - Python script shows correct version

This commit is contained in:
hockeygoalie35 2024-02-13 09:34:17 -05:00
parent 106e620a7a
commit d60015a050

View file

@ -90,7 +90,7 @@ class DeezerPlatformProvider:
) )
res.raise_for_status() res.raise_for_status()
except Exception as error: 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() raise ConnectionError()
self.session.cookies.clear() self.session.cookies.clear()
@ -98,17 +98,17 @@ class DeezerPlatformProvider:
try: try:
res = res.json() res = res.json()
except Exception as error: 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() raise ParseError()
if 'error' in res and res['error']: 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() raise ServiceError()
res = res['results'] res = res['results']
if res['USER']['USER_ID'] == 0: 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() raise AuthError()
return Account(username, secret, res['COUNTRY'], Plan( return Account(username, secret, res['COUNTRY'], Plan(
@ -203,7 +203,7 @@ class LidarrExtendedAPI:
def check_token(self, token=None): def check_token(self, token=None):
logger.info('Checking ARL Token Validity...') logger.info('Checking ARL Token Validity...')
if token == '""': 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") self.report_status("NOT SET")
exit(0) exit(0)
if token is None: if token is None:
@ -213,14 +213,14 @@ class LidarrExtendedAPI:
deezer_check = DeezerPlatformProvider() deezer_check = DeezerPlatformProvider()
account = deezer_check.login('', token.replace('"','')) account = deezer_check.login('', token.replace('"',''))
if account.plan: 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('-------------------------------')
logger.info(f'Plan: {account.plan.name}') logger.info(f'Plan: {account.plan.name}')
logger.info(f'Expiration: {account.plan.expires}') 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'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.WHITE) 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.WHITE) 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.WHITE) logger.info(f'Explicit: {Fore.GREEN+"Y" if account.plan.explicit else Fore.RED+"N"}'+Fore.LIGHTWHITE_EX)
logger.info('-------------------------------') logger.info('-------------------------------')
self.report_status('VALID') self.report_status('VALID')
return True return True
@ -357,9 +357,9 @@ def main(arlToken = None):
arlToken_instance.check_token(arlToken_instance.arlToken) arlToken_instance.check_token(arlToken_instance.arlToken)
except Exception as e: except Exception as e:
if 'Chat not found' in str(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): 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: else:
print(e) print(e)
exit(1) exit(1)