From ffd1f7f3788f90dc3b59012928a713afedd52f1c Mon Sep 17 00:00:00 2001 From: lzzy12 Date: Sun, 22 Sep 2019 22:26:00 +0530 Subject: [PATCH] ariaTools: Add a function to get file name of download --- .gitignore | 3 ++- aria.sh | 0 bot/helper/ariaTools.py | 4 +++- bot/mirror.py | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) mode change 100644 => 100755 aria.sh diff --git a/.gitignore b/.gitignore index fb55e72..0895daf 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ config.ini *.pyc downloads/* download/* -data* \ No newline at end of file +data* +.vscode \ No newline at end of file diff --git a/aria.sh b/aria.sh old mode 100644 new mode 100755 diff --git a/bot/helper/ariaTools.py b/bot/helper/ariaTools.py index 0209c64..e5943ff 100644 --- a/bot/helper/ariaTools.py +++ b/bot/helper/ariaTools.py @@ -46,6 +46,9 @@ def remove_download(message): return True +def get_file_name(download): + file = aria2.get_download(download.gid) + return file.name def get_download_by_message(message): if allDls[message] == None: @@ -88,4 +91,3 @@ def progress_status(context,update,previous): LOGGER.info(file.name+" Completed.") msg = ""+str(file.name) +":- Uploading." context.bot.edit_message_text(text=msg,message_id=update.message_id,chat_id=update.chat.id,parse_mode='HTMl') - return file.name diff --git a/bot/mirror.py b/bot/mirror.py index 3c76770..20942c2 100644 --- a/bot/mirror.py +++ b/bot/mirror.py @@ -9,7 +9,8 @@ def mirror(update,context): link = message.replace('/mirror','')[1:] reply_msg = context.bot.send_message(chat_id=update.message.chat_id, reply_to_message_id=update.message.message_id, text="Starting Download") download = ariaTools.add_download(link,[reply_msg,update]) - file_name = ariaTools.progress_status(context,reply_msg,previous=None) + ariaTools.progress_status(context,reply_msg,previous=None) + file_name = ariaTools.get_file_name(download) LOGGER.info("File-Name: "+file_name) try: link = gdriveTools.upload(file_name)