From 351a1677c0d185e7e68ac7e7076d09d511a79285 Mon Sep 17 00:00:00 2001 From: Anas <77075674+anasty17@users.noreply.github.com> Date: Sat, 12 Jun 2021 00:34:14 +0300 Subject: [PATCH] hot fix (#164) * fix clone count * remove mega useless logs --- .../mirror_utils/download_utils/mega_downloader.py | 9 +++------ bot/helper/mirror_utils/upload_utils/gdriveTools.py | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py index 6e37d042047..f674ed361ec 100644 --- a/bot/helper/mirror_utils/download_utils/mega_downloader.py +++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py @@ -58,11 +58,9 @@ def downloaded_bytes(self): return self.__bytes_transferred def onRequestStart(self, api, request): - LOGGER.info('Request start ({})'.format(request)) + pass def onRequestFinish(self, api, request, error): - LOGGER.info('Mega Request finished ({}); Result: {}' - .format(request, error)) if str(error).lower() != "no error": self.error = error.copy() return @@ -87,7 +85,7 @@ def onRequestTemporaryError(self, api, request, error: MegaError): self.continue_event.set() def onTransferStart(self, api: MegaApi, transfer: MegaTransfer): - LOGGER.info(f"Transfer Started: {transfer.getFileName()}") + pass def onTransferUpdate(self, api: MegaApi, transfer: MegaTransfer): if self.is_cancelled: @@ -97,7 +95,6 @@ def onTransferUpdate(self, api: MegaApi, transfer: MegaTransfer): def onTransferFinish(self, api: MegaApi, transfer: MegaTransfer, error): try: - LOGGER.info(f'Transfer finished ({transfer}); Result: {transfer.getFileName()}') if transfer.isFolderTransfer() and transfer.isFinished() or transfer.getFileName() == self.name and not self.is_cancelled: self.listener.onDownloadComplete() self.continue_event.set() @@ -205,10 +202,10 @@ def add_download(mega_link: str, path: str, listener): return else: deleteMessage(listener.bot, msg2) - sendStatusMessage(listener.update, listener.bot) with download_dict_lock: download_dict[listener.uid] = MegaDownloadStatus(mega_listener, listener) os.makedirs(path) gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=8)) mega_listener.setValues(node.getName(), api.getSize(node), gid) + sendStatusMessage(listener.update, listener.bot) executor.do(api.startDownload,(node,path)) diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py index 561952d9734..a36b4b5b17e 100644 --- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py +++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py @@ -322,6 +322,8 @@ def getFilesByFolderId(self,folder_id): def clone(self, link): self.transferred_size = 0 + self.total_files = 0 + self.total_folders = 0 try: file_id = self.getIdFromUrl(link) except (KeyError,IndexError):