diff --git a/bot/helper/common.py b/bot/helper/common.py index 08b90e22b..e5c100bcb 100644 --- a/bot/helper/common.py +++ b/bot/helper/common.py @@ -80,6 +80,7 @@ def __init__(self): self.subname = "" self.new_dir = "" self.name_sub = "" + self.metadata = "" self.thumbnail_layout = "" self.folder_name = "" self.split_size = 0 @@ -160,6 +161,11 @@ async def before_start(self): or self.user_dict.get("name_sub", False) or (Config.NAME_SUBSTITUTE if "name_sub" not in self.user_dict else "") ) + self.metadata = ( + self.metadata + or self.user_dict.get("metadata", False) + or (Config.METADATA_KEY if "metadata" not in self.user_dict else "") + ) if self.name_sub: self.name_sub = [x.split("/") for x in self.name_sub.split(" | ")] self.seed = False diff --git a/bot/helper/listeners/task_listener.py b/bot/helper/listeners/task_listener.py index 401c00c07..d511a3e4a 100644 --- a/bot/helper/listeners/task_listener.py +++ b/bot/helper/listeners/task_listener.py @@ -208,6 +208,17 @@ async def on_download_complete(self): self.is_file = await aiopath.isfile(up_path) self.name = up_path.rsplit("/", 1)[1] + if self.metadata: + up_path = await self.proceed_metadata(up_path, gid) + if self.is_cancelled: + return + self.is_file = await aiopath.isfile(up_path) + up_dir, self.name = up_path.rsplit("/", 1) + self.size = await get_path_size(up_dir) + self.subproc = None + self.subname = "" + self.subsize = 0 + if self.screen_shots: up_path = await self.generate_screenshots(up_path) if self.is_cancelled: diff --git a/bot/modules/mirror_leech.py b/bot/modules/mirror_leech.py index 3dff3a616..31f52e157 100644 --- a/bot/modules/mirror_leech.py +++ b/bot/modules/mirror_leech.py @@ -118,6 +118,7 @@ async def new_event(self): "-ca": "", "-cv": "", "-ns": "", + "-md": "", "-tl": "", "-ff": "None", } @@ -147,6 +148,7 @@ async def new_event(self): self.thumbnail_layout = args["-tl"] self.as_doc = args["-doc"] self.as_med = args["-med"] + self.metadata = args["-md"] self.folder_name = f"/{args["-m"]}" if len(args["-m"]) > 0 else "" headers = args["-h"] diff --git a/bot/modules/ytdlp.py b/bot/modules/ytdlp.py index 63273abd3..3d1a40ce4 100644 --- a/bot/modules/ytdlp.py +++ b/bot/modules/ytdlp.py @@ -331,6 +331,7 @@ async def new_event(self): "-ca": "", "-cv": "", "-ns": "", + "-md": "", "-tl": "", "-ff": "None", } @@ -371,6 +372,7 @@ async def new_event(self): self.thumbnail_layout = args["-tl"] self.as_doc = args["-doc"] self.as_med = args["-med"] + self.metadata = args["-md"] self.folder_name = f"/{args["-m"]}" if len(args["-m"]) > 0 else "" is_bulk = args["-b"]