diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index ab9d78e950d..962d78c4af3 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -155,6 +155,10 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
'description': 'Uploaded by Slam Mirror Bot',
'mimeType': mime_type,
}
+ try:
+ self.typee = file_metadata['mimeType']
+ except:
+ self.typee = 'File'
if parent_id is not None:
file_metadata['parents'] = [parent_id]
@@ -206,6 +210,8 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
return download_url
def upload(self, file_name: str):
+ self.total_files = 0
+ self.total_folders = 0
if USE_SERVICE_ACCOUNTS:
self.service_account_count = len(os.listdir("accounts"))
self.__listener.onUploadStarted()
@@ -253,7 +259,10 @@ def upload(self, file_name: str):
finally:
self.updater.cancel()
LOGGER.info(download_dict)
- self.__listener.onUploadComplete(link, size)
+ files = self.total_files
+ folders = self.total_folders
+ typ = self.typee
+ self.__listener.onUploadComplete(link, size, files, folders, typ)
LOGGER.info("Deleting downloaded file/folder..")
return link
@@ -447,11 +456,13 @@ def upload_dir(self, input_directory, parent_id):
if os.path.isdir(current_file_name):
current_dir_id = self.create_directory(item, parent_id)
new_id = self.upload_dir(current_file_name, current_dir_id)
+ self.total_folders += 1
else:
mime_type = get_mime_type(current_file_name)
file_name = current_file_name.split("/")[-1]
# current_file_name will have the full path
self.upload_file(current_file_name, file_name, mime_type, parent_id)
+ self.total_files += 1
new_id = parent_id
return new_id
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 730234c64bb..a5442056ea2 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -146,7 +146,7 @@ def onUploadStarted(self):
def onUploadProgress(self):
pass
- def onUploadComplete(self, link: str, size):
+ def onUploadComplete(self, link: str, size, files, folders, typ):
with download_dict_lock:
msg = f'Filename: {download_dict[self.uid].name()}
\nSize: {size}
'
buttons = button_build.ButtonMaker()
@@ -161,6 +161,11 @@ def onUploadComplete(self, link: str, size):
share_url = f'{INDEX_URL}/{url_path}'
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
share_url += '/'
+ msg += "\n\nType: Folder"
+ msg += f"\nSubFolders: {folders}"
+ msg += f"\nFiles: {files}"
+ else:
+ msg += f"\n\nType: {typ}"
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
buttons.buildbutton("⚡Index Link⚡", siurl)