ariaTools: Add a function to get file name of download

This commit is contained in:
lzzy12 2019-09-22 22:26:00 +05:30
parent 6bb1224aa7
commit ffd1f7f378
4 changed files with 7 additions and 3 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ config.ini
*.pyc
downloads/*
download/*
data*
data*
.vscode

0
aria.sh Normal file → Executable file
View File

View File

@ -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 = "<i>"+str(file.name) +"</i>:- Uploading."
context.bot.edit_message_text(text=msg,message_id=update.message_id,chat_id=update.chat.id,parse_mode='HTMl')
return file.name

View File

@ -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)