Add text status report fallback if user doesn't use Telegram bot.
This commit is contained in:
parent
7cfd44f828
commit
d8ad588cbe
2 changed files with 14 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
scriptVersion="0.5"
|
scriptVersion="0.1"
|
||||||
scriptName="ARLChecker"
|
scriptName="ARLChecker"
|
||||||
|
|
||||||
### Import Settings
|
### Import Settings
|
||||||
|
|
|
@ -9,6 +9,7 @@ from telegram import Update
|
||||||
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
|
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
VERSION = 0.1
|
VERSION = 0.1
|
||||||
|
@ -199,6 +200,7 @@ class LidarrExtendedAPI:
|
||||||
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.WHITE)
|
||||||
|
self.report_status("NOT SET")
|
||||||
exit(0)
|
exit(0)
|
||||||
if token is None:
|
if token is None:
|
||||||
print('Invalid ARL Token Entry')
|
print('Invalid ARL Token Entry')
|
||||||
|
@ -216,10 +218,11 @@ class LidarrExtendedAPI:
|
||||||
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.WHITE)
|
||||||
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.WHITE)
|
||||||
logger.info('-------------------------------')
|
logger.info('-------------------------------')
|
||||||
|
self.report_status('VALID')
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
self.report_status('EXPIRED')
|
||||||
if self.telegram_bot_running:
|
if self.telegram_bot_running:
|
||||||
return False
|
return False
|
||||||
if self.enable_telegram_bot:
|
if self.enable_telegram_bot:
|
||||||
|
@ -243,6 +246,12 @@ class LidarrExtendedAPI:
|
||||||
file_to_delete = os.path.join(path,file)
|
file_to_delete = os.path.join(path,file)
|
||||||
os.remove(file_to_delete)
|
os.remove(file_to_delete)
|
||||||
|
|
||||||
|
def report_status(self, status):
|
||||||
|
f = open("ARLStatus.txt", "w")
|
||||||
|
now = datetime.strftime(datetime.now(),"%b-%d-%Y at %H:%M:%S")
|
||||||
|
f.write(f"{now}: ARL Token is {status}.{' Please update arlToken in extended.conf' if status=='EXPIRED' else ''}")
|
||||||
|
f.close()
|
||||||
|
|
||||||
def start_telegram_bot(self):
|
def start_telegram_bot(self):
|
||||||
self.bot = TelegramBotControl(self,self.telegram_bot_token,self.telegram_user_chat_id)
|
self.bot = TelegramBotControl(self,self.telegram_bot_token,self.telegram_user_chat_id)
|
||||||
|
|
||||||
|
@ -322,6 +331,8 @@ class TelegramBotControl:
|
||||||
await update.message.reply_text(text="Token expired or inactive. try another token.")
|
await update.message.reply_text(text="Token expired or inactive. try another token.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main(arlToken = None):
|
def main(arlToken = None):
|
||||||
parser = ArgumentParser(prog='Account Checker', description='Check if Deezer ARL Token is valid')
|
parser = ArgumentParser(prog='Account Checker', description='Check if Deezer ARL Token is valid')
|
||||||
parser.add_argument('-c', '--check', help='Check if current ARL Token is active/valid',required=False, default=False, action='store_true')
|
parser.add_argument('-c', '--check', help='Check if current ARL Token is active/valid',required=False, default=False, action='store_true')
|
||||||
|
@ -364,4 +375,4 @@ def main(arlToken = None):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main('dasdasd')
|
main('FAKETOKEN')
|
||||||
|
|
Loading…
Reference in a new issue