Change status while archiving download
Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
parent
1761d16f70
commit
65303e3143
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue