Skip to content

Commit

Permalink
hot fix (breakdowns#164)
Browse files Browse the repository at this point in the history
* fix clone count

* remove mega useless logs
  • Loading branch information
anasty17 authored Jun 11, 2021
1 parent c92d954 commit 351a167
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 3 additions & 6 deletions bot/helper/mirror_utils/download_utils/mega_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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()
Expand Down Expand Up @@ -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))
2 changes: 2 additions & 0 deletions bot/helper/mirror_utils/upload_utils/gdriveTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 351a167

Please sign in to comment.