diff --git a/app/plugins/files/download.py b/app/plugins/files/download.py index fb4ec1d..956a009 100644 --- a/app/plugins/files/download.py +++ b/app/plugins/files/download.py @@ -39,7 +39,7 @@ async def down_load(bot: BOT, message: Message): ) else: if "-f" in message.flags: - file_name, url = message.flt_input.split() + file_name, url = message.flt_input.split(maxsplit=1) else: url = message.flt_input dl_obj: Download = await Download.setup( diff --git a/app/plugins/files/rename.py b/app/plugins/files/rename.py index 7ab5f2d..81e9ee7 100644 --- a/app/plugins/files/rename.py +++ b/app/plugins/files/rename.py @@ -22,9 +22,9 @@ async def rename(bot: BOT, message: Message): """ input = message.flt_input response = await message.reply("Checking input...") - if (not message.replied or not message.replied.media) and not message.flt_input: + if not message.replied or not message.replied.media or not message.flt_input: await response.edit( - "Invalid input...\nReply to a message containing media or give a link and filename with cmd." + "Invalid input...\nReply to a message containing media or give a link and a filename with cmd." ) return dl_path = os.path.join("downloads", str(time.time())) @@ -37,7 +37,7 @@ async def rename(bot: BOT, message: Message): response=response, ) else: - url, file_name = input.split() + url, file_name = input.split(maxsplit=1) dl_obj: Download = await Download.setup( url=url, path=dl_path, message_to_edit=response, custom_file_name=file_name ) diff --git a/app/utils/shell.py b/app/utils/shell.py index eeba110..8f3ee42 100644 --- a/app/utils/shell.py +++ b/app/utils/shell.py @@ -21,14 +21,14 @@ async def take_ss(video: str, path: str) -> None | str: async def check_audio(file) -> int: result = await run_shell_cmd( - f"ffprobe -v error -show_entries format=nb_streams -of default=noprint_wrappers=1:nokey=1 {file}" + f'''ffprobe -v error -show_entries format=nb_streams -of default=noprint_wrappers=1:nokey=1 "{file}"''' ) return int(result or 0) - 1 async def get_duration(file) -> int: duration = await run_shell_cmd( - f"""ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 {file}""" + f'''ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "{file}"''' ) return round(float(duration.strip() or 0))