diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py index 454e178..db0c354 100644 --- a/bot/helper/ext_utils/bot_utils.py +++ b/bot/helper/ext_utils/bot_utils.py @@ -10,6 +10,7 @@ class MirrorStatus: STATUS_WAITING = "Queued" STATUS_FAILED = "Failed. Cleaning download" STATUS_CANCELLED = "Cancelled" + STATUS_ARCHIVING = "Archiving" PROGRESS_MAX_SIZE = 100 // 8 diff --git a/bot/helper/mirror_utils/download_status.py b/bot/helper/mirror_utils/download_status.py index 010a895..c036725 100644 --- a/bot/helper/mirror_utils/download_status.py +++ b/bot/helper/mirror_utils/download_status.py @@ -10,6 +10,7 @@ class DownloadStatus: def __init__(self, gid, message_id): self.upload_name = None + self.is_archiving = False self.__gid = gid self.__download = get_download(gid) self.__uid = message_id @@ -78,6 +79,8 @@ class DownloadStatus: def status(self): self.__update() status = None + if self.is_archiving: + status = MirrorStatus.STATUS_ARCHIVING if self.__download.is_waiting: status = MirrorStatus.STATUS_WAITING elif self.download().is_paused: diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py index 1b03abf..dd9a2c3 100644 --- a/bot/modules/mirror.py +++ b/bot/modules/mirror.py @@ -31,11 +31,15 @@ class MirrorListener(listeners.MirrorListeners): def onDownloadComplete(self, progress_status_list, index: int): LOGGER.info(f"Download completed: {progress_status_list[index].name()}") if self.isTar: + with download_dict_lock: + download_dict[self.uid].is_archiving = True path = fs_utils.tar(f'{DOWNLOAD_DIR}{self.uid}/{progress_status_list[index].name()}') else: path = f'{DOWNLOAD_DIR}{self.uid}/{progress_status_list[index].name()}' name = pathlib.PurePath(path).name - download_dict[self.uid].upload_name = name + with download_dict_lock: + download_dict[self.uid].is_archiving = False + download_dict[self.uid].upload_name = name gdrive = gdriveTools.GoogleDriveHelper(self) gdrive.upload(name)