From 9d498beceda563ffce6a08f0b6dbd0e5e1f812e4 Mon Sep 17 00:00:00 2001 From: Xron Trix Date: Tue, 10 Oct 2023 20:00:23 +0530 Subject: [PATCH] Dir-Leech fixed --- colab_leecher/utility/handler.py | 3 +++ colab_leecher/utility/task_manager.py | 10 +++++++--- colab_leecher/utility/variables.py | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/colab_leecher/utility/handler.py b/colab_leecher/utility/handler.py index 5b802f2..c3b8527 100644 --- a/colab_leecher/utility/handler.py +++ b/colab_leecher/utility/handler.py @@ -89,6 +89,9 @@ async def Leech(folder_path: str, remove: bool): shutil.rmtree(Paths.temp_zpath) else: + if not ospath.exists(Paths.temp_files_dir): # Create Directory + makedirs(Paths.temp_files_dir) + if not remove: # Copy To Temp Dir for Renaming Purposes file_path = shutil.copy(file_path, Paths.temp_files_dir) file_name = ospath.basename(file_path) diff --git a/colab_leecher/utility/task_manager.py b/colab_leecher/utility/task_manager.py index 4d9ca73..d1485f4 100644 --- a/colab_leecher/utility/task_manager.py +++ b/colab_leecher/utility/task_manager.py @@ -94,7 +94,7 @@ async def taskScheduler(): if ospath.exists(Paths.WORK_PATH): shutil.rmtree(Paths.WORK_PATH) - makedirs(Paths.WORK_PATH) + # makedirs(Paths.WORK_PATH) makedirs(Paths.down_path) else: makedirs(Paths.WORK_PATH) @@ -128,7 +128,11 @@ async def taskScheduler(): ) await calDownSize(BOT.SOURCE) - await get_d_name(BOT.SOURCE[0]) + + if not is_dir: + await get_d_name(BOT.SOURCE[0]) + else: + Messages.download_name = ospath.basename(BOT.SOURCE[0]) if is_zip: Paths.down_path = ospath.join(Paths.down_path, Messages.download_name) @@ -137,7 +141,7 @@ async def taskScheduler(): BotTimes.current_time = time() - if BOT.Mode.mode == "leech": + if BOT.Mode.mode != "mirror": await Do_Leech(BOT.SOURCE, is_dir, BOT.Mode.ytdl, is_zip, is_unzip, is_dualzip) else: await Do_Mirror(BOT.SOURCE, BOT.Mode.ytdl, is_zip, is_unzip, is_dualzip) diff --git a/colab_leecher/utility/variables.py b/colab_leecher/utility/variables.py index 77c13bb..3c0a311 100644 --- a/colab_leecher/utility/variables.py +++ b/colab_leecher/utility/variables.py @@ -80,7 +80,7 @@ class Paths: mirror_dir = "/content/drive/MyDrive/Colab Leecher Uploads" temp_zpath = f"{WORK_PATH}/Leeched_Files" temp_unzip_path = f"{WORK_PATH}/Unzipped_Files" - temp_files_dir = f"{WORK_PATH}/dir_leech_temp" + temp_files_dir = f"{WORK_PATH}/leech_temp" thumbnail_ytdl = f"{WORK_PATH}/ytdl_thumbnails" access_token = "/content/token.pickle"