EDM115 / unzip-bot

Telegram bot deployable to heroku that can extract every archive !
https://t.me/unzip_edm115bot
MIT License
86 stars 120 forks source link

[BUG] archives fails at being tested randomly #269

Closed EDM115 closed 6 months ago

EDM115 commented 6 months ago

a commit from 19/01/2024 caused this. tho idk which.
error 1 :

2024-01-19 14:23:45,354 - INFO - unzipper - MainThread - location: /app/Downloaded/ID/Flux - Slingshot (128).mp3.tar.gz
2024-01-19 14:23:46,412 - INFO - unzipper - asyncio_1 - 
2024-01-19 14:23:46,513 - INFO - unzipper - MainThread - Error on test

other error :

2024-01-19 14:20:22,694 - INFO - unzipper - asyncio_0 - 
7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Scanning the drive for archives:
2024-01-19 14:20:22,751 - INFO - unzipper - MainThread - Error on test
EDM115 commented 6 months ago

ideas :

whole diff so i can cry about it :

git diff 2d9b64a74225391ed6e0344a1e9d832b37bce5d7 27de4e3e831f449ab43cca310a3b2a675777905d
diff --git a/config.py b/config.py
index ce012a5..f68ea05 100644
--- a/config.py
+++ b/config.py
@@ -12,6 +12,7 @@ class Config:
     DOWNLOAD_LOCATION = f"{os.path.dirname(__file__)}/Downloaded"
     THUMB_LOCATION = f"{os.path.dirname(__file__)}/Thumbnails"
     TG_MAX_SIZE = 2097152000
+    MAX_MESSAGE_LENGTH = 4096
     # Default chunk size (0.005 MB → 1024*6) Increase if you need faster downloads
     CHUNK_SIZE = 1024 * 1024 * 10  # 10 MB
     BOT_THUMB = f"{os.path.dirname(__file__)}/bot_thumb.jpg"
diff --git a/requirements.lock b/requirements.lock
index c6a6ea4..e03a414 100644
--- a/requirements.lock
+++ b/requirements.lock
@@ -12,6 +12,7 @@ GitPython==3.1.41
 idna==3.4
 motor==3.3.2
 multidict==6.0.4
+mutagen==1.47.0
 Pillow==10.1.0
 psutil==5.9.7
 pyaes==1.6.1
diff --git a/requirements.txt b/requirements.txt
index a302afe..2b15da5 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,6 +5,7 @@ dnspython==2.4.2
 gitdb==4.0.11
 GitPython==3.1.41
 motor==3.3.2
+mutagen==1.47.0
 Pillow==10.1.0
 psutil==5.9.7
 pykeyboard==0.1.5
diff --git a/unzipper/__main__.py b/unzipper/__main__.py
index 4e619ec..e0b061c 100644
--- a/unzipper/__main__.py
+++ b/unzipper/__main__.py
@@ -11,13 +11,10 @@ from . import LOGGER, unzipperbot
 from .helpers.start import check_logs, dl_thumbs, set_boot_time, removal
 from .modules.bot_data import Messages

-running = True
-

 def handler_stop_signals(signum, frame):
-    global running
     LOGGER.info("Received stop signal (%s, %s, %s). Exiting...", signal.Signals(signum).name, signum, frame)
-    running = False
+    shutdown_bot()

 signal.signal(signal.SIGINT, handler_stop_signals)
@@ -33,7 +30,7 @@ def shutdown_bot():
     except Exception as e:
         LOGGER.error("Error sending shutdown message: %s", e)
     finally:
-        unzipperbot.stop()
+        unzipperbot.stop(block=False)
         LOGGER.info("Bot stopped 😪")

@@ -56,8 +53,7 @@ if __name__ == "__main__":
             LOGGER.info(Messages.LOG_CHECKED)
             LOGGER.info(Messages.BOT_RUNNING)
             removal(True)
-            while running:
-                idle()
+            idle()
         else:
             try:
                 unzipperbot.send_message(
diff --git a/unzipper/modules/callbacks.py b/unzipper/modules/callbacks.py
index 8a2c49c..7533829 100644
--- a/unzipper/modules/callbacks.py
+++ b/unzipper/modules/callbacks.py
@@ -545,20 +545,24 @@ async def unzipper_cb(unzip_bot: Client, query: CallbackQuery):
                             await query.message.edit(Messages.NOT_AN_ARCHIVE)
                             return
                         content_disposition = unzip_head.headers.get('content-disposition')
+                        rfnamebro = ""
+                        real_filename = ""
                         if content_disposition:
                             _, params = cgi.parse_header(content_disposition)
                             real_filename = params.get('filename')
-                            if real_filename:
+                            if real_filename != "":
                                 rfnamebro = unquote(real_filename)
-                        if not rfnamebro:
+                        if rfnamebro == "":
                             rfnamebro = unquote(url.split("/")[-1])
                         if unzip_resp.status == 200:
                             os.makedirs(download_path)
                             s_time = time()
                             if real_filename:
                                 archive = os.path.join(download_path, real_filename)
+                                fext = real_filename.split(".")[-1].casefold()
                             else:
                                 fname = unquote(os.path.splitext(url)[1])
+                                fname = fname.split("?")[0]
                                 fext = fname.split(".")[-1].casefold()
                                 archive = f"{download_path}/{fname}"
                             if (
@@ -688,9 +692,10 @@ async def unzipper_cb(unzip_bot: Client, query: CallbackQuery):
                         await del_ongoing_task(user_id)
                         await query.message.edit(Messages.DEF_NOT_AN_ARCHIVE)
                         return
-                os.makedirs(download_path)
+                os.makedirs(download_path, exist_ok=True)
                 s_time = time()
                 location = f"{download_path}/{fname}"
+                LOGGER.info("location: %s", location)
                 archive = await r_message.download(
                     file_name=location,
                     progress=progress_for_pyrogram,
@@ -832,6 +837,7 @@ async def unzipper_cb(unzip_bot: Client, query: CallbackQuery):
                     )
                     ext_e_time = time()
                 else:
+                    LOGGER.info("Error on test")
                     extractor = "Error"
                     ext_e_time = time()
             # Checks if there is an error happened while extracting the archive
diff --git a/unzipper/modules/commands.py b/unzipper/modules/commands.py
index 6c75e75..b86182b 100644
--- a/unzipper/modules/commands.py
+++ b/unzipper/modules/commands.py
@@ -1,11 +1,15 @@
 # Copyright (c) 2022 - 2024 EDM115
+import io
 import os
 import re
 import shutil
 import time
-from asyncio import sleep
+import traceback
+from asyncio import sleep, create_subprocess_shell, subprocess
+from contextlib import redirect_stdout, redirect_stderr
 from sys import executable

+
 import git
 import psutil
 from pyrogram import enums, filters
@@ -128,6 +132,8 @@ async def extract_archive(_, message: Message):
     try:
         if message.chat.type != enums.ChatType.PRIVATE:
             return
+        if message.command and message.command[0] in ["eval", "exec"]:
+            return
         unzip_msg = await message.reply(Messages.PROCESSING2, reply_to_message_id=message.id)
         user_id = message.from_user.id
         download_path = f"{Config.DOWNLOAD_LOCATION}/{user_id}"
@@ -595,7 +601,6 @@ async def pull_updates(_, message: Message):
     repo = git.Repo("/app")
     current = repo.head.commit
     repo.remotes.origin.pull()
-    time.sleep(2)
     if current != repo.head.commit:
         await git_reply.edit(Messages.PULLED)
         await restart(_, message)
@@ -727,104 +732,80 @@ async def getadmin_cmds(_, message):
     )

-disabled = """ async def exec_message_f(client, message):
-    if message.from_user.id in AUTH_CHANNEL:
-        DELAY_BETWEEN_EDITS = 0.3
-        PROCESS_RUN_TIME = 100
-        cmd = message.text.split(" ", maxsplit=1)[1]
-
-        reply_to_id = message.message_id
-        if message.reply_to_message:
-            reply_to_id = message.reply_to_message.message_id
-
-        start_time = time.time() + PROCESS_RUN_TIME
-        process = await asyncio.create_subprocess_shell(
-            cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
-        )
-        stdout, stderr = await process.communicate()
-        e = stderr.decode()
-        if not e:
-            e = "No Error"
-        o = stdout.decode()
-        if not o:
-            o = "No Output"
-        else:
-            _o = o.split("\n")
-            o = "`\n".join(_o)
-        OUTPUT = f"**QUERY:**\n__Command:__\n`{cmd}` \n__PID:__\n`{process.pid}`\n\n**stderr:** \n`{e}`\n**Output:**\n{o}"
-
-        if len(OUTPUT) > MAX_MESSAGE_LENGTH:
-            with io.BytesIO(str.encode(OUTPUT)) as out_file:
-                out_file.name = "exec.text"
-                await client.send_document(
-                    chat_id=message.chat.id,
-                    document=out_file,
-                    caption=cmd,
-                    disable_notification=True,
-                    reply_to_message_id=reply_to_id,
+async def aexec(code, client, message):
+    stdout = io.StringIO()
+    stderr = io.StringIO()
+    result = None
+    with redirect_stdout(stdout), redirect_stderr(stderr):
+        try:
+            try:
+                result = eval(code)
+            except SyntaxError:
+                exec(
+                    f"async def __aexec(client, message): "
+                    + "".join(f"\n {l}" for l in code.split("\n"))
                 )
-            await message.delete()
-        else:
-            await message.reply_text(OUTPUT)
+                await locals()["__aexec"](client, message)
+        except Exception as e:
+            stderr.write(f"{type(e).__name__}: {str(e)}\n")
+    return stdout.getvalue(), stderr.getvalue(), result
+
+
+@unzipperbot.on_message(filters.command("eval") & filters.user(Config.BOT_OWNER))
+async def eval_command(_, message):
+    status_message = await message.reply_text("Processing ...")
+    cmd = message.text.split(" ", maxsplit=1)[1]
+
+    stdout, stderr, result = await aexec(cmd, _, message)
+    LOGGER.info("stdout: " + stdout)
+    LOGGER.info("stderr: " + stderr)
+
+    if result is not None:
+        evaluation = str(result)
+    elif stderr.strip():
+        evaluation = stderr.strip()
+    elif stdout.strip():
+        evaluation = stdout.strip()
+    else:
+        evaluation = "Success"

-async def eval_message_f(client, message):
-    if message.from_user.id in AUTH_CHANNEL:
-        status_message = await message.reply_text("Processing ...")
-        cmd = message.text.split(" ", maxsplit=1)[1]
+    final_output = f"<b>EVAL</b>: <code>{cmd}</code>\n\n<b>OUTPUT</b>:\n<code>{evaluation}</code> \n"

-        reply_to_id = message.message_id
-        if message.reply_to_message:
-            reply_to_id = message.reply_to_message.message_id
+    if len(final_output) > Config.MAX_MESSAGE_LENGTH:
+        with open("eval.txt", "w+", encoding="utf8") as out_file:
+            out_file.write(str(final_output))
+        await message.reply_document(
+            document="eval.txt",
+            caption=cmd,
+            reply_to_message_id=message.id,
+        )
+        await status_message.delete()
+        os.remove("eval.txt")
+    else:
+        await status_message.edit(final_output)

-        old_stderr = sys.stderr
-        old_stdout = sys.stdout
-        redirected_output = sys.stdout = io.StringIO()
-        redirected_error = sys.stderr = io.StringIO()
-        stdout, stderr, exc = None, None, None

-        try:
-            await aexec(cmd, client, message)
-        except Exception:
-            exc = traceback.format_exc()
-
-        stdout = redirected_output.getvalue()
-        stderr = redirected_error.getvalue()
-        sys.stdout = old_stdout
-        sys.stderr = old_stderr
-
-        evaluation = ""
-        if exc:
-            evaluation = exc
-        elif stderr:
-            evaluation = stderr
-        elif stdout:
-            evaluation = stdout
-        else:
-            evaluation = "Success"
+@unzipperbot.on_message(filters.command("exec") & filters.user(Config.BOT_OWNER))
+async def exec_command(_, message):
+    cmd = message.text.split(" ", maxsplit=1)[1]
+    process = await create_subprocess_shell(
+        cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
+    )
+    stdout, stderr = await process.communicate()
+    e = stderr.decode()
+    o = stdout.decode()

-        final_output = (
-            "<b>EVAL</b>: <code>{}</code>\n\n<b>OUTPUT</b>:\n<code>{}</code> \n".format(
-                cmd, evaluation.strip()
-            )
-        )
+    e = e or "No Error"
+    o = o or "No Output"
+    OUTPUT = f"**COMMAND:**\n`{cmd}`\n\n**OUTPUT:**\n{o}\n\n**ERROR:**\n`{e}`"

-        if len(final_output) > MAX_MESSAGE_LENGTH:
-            with open("eval.text", "w+", encoding="utf8") as out_file:
-                out_file.write(str(final_output))
+    if len(OUTPUT) > Config.MAX_MESSAGE_LENGTH:
+        with io.BytesIO(str.encode(OUTPUT)) as out_file:
+            out_file.name = "exec.txt"
             await message.reply_document(
-                document="eval.text",
+                document=out_file,
                 caption=cmd,
-                disable_notification=True,
-                reply_to_message_id=reply_to_id,
+                reply_to_message_id=message.id,
             )
-            os.remove("eval.text")
-            await status_message.delete()
-        else:
-            await status_message.edit(final_output)
-
-async def aexec(code, client, message):
-    exec(
-        f"async def __aexec(client, message): "
-        + "".join(f"\n {l}" for l in code.split("\n"))
-    )
-    return await locals()["__aexec"](client, message) """
+    else:
+        await message.reply_text(OUTPUT)
diff --git a/unzipper/modules/ext_script/ext_helper.py b/unzipper/modules/ext_script/ext_helper.py
index 816fbb3..a321d86 100644
--- a/unzipper/modules/ext_script/ext_helper.py
+++ b/unzipper/modules/ext_script/ext_helper.py
@@ -13,6 +13,12 @@ from unzipper import LOGGER
 from unzipper.modules.bot_data import Messages

+# Get files in directory as a list
+async def get_files(path):
+    path_list = [val for sublist in [[os.path.join(i[0], j) for j in i[2]] for i in os.walk(path)] for val in sublist]  # skipcq: FLK-E501
+    return sorted(path_list)
+
+
 async def cleanup_macos_artifacts(extraction_path):
     for root, dirs, files in os.walk(extraction_path):
         for name in files:
@@ -46,6 +52,7 @@ async def run_cmds_on_cr(func, **kwargs):

 # Extract with 7z
 async def _extract_with_7z_helper(path, archive_path, password=None):
+    LOGGER.info("7z : " + archive_path + " : " + path)
     if password:
         command = f'7z x -o{path} -p"{password}" {archive_path} -y'
     else:
@@ -54,7 +61,7 @@ async def _extract_with_7z_helper(path, archive_path, password=None):

 async def _test_with_7z_helper(archive_path):
-    command = f'7z t {archive_path} -p"dont care + didnt ask + cry about it + stay mad + get real + L + mald seethe cope harder + h0es mad + basic + skill issue + ratio + you fell off + the audacity + triggered + any askers + redpilled + get a life + ok and? + cringe + touch grass + donowalled + not based + your’re probably white + not funny didn’t laugh + you’re* + grammar issue + go outside + get good + reported + ad hominem + GG! + ur momdon’t care + didn’t ask + cry about it + stay mad + get real + L + mald seethe cope harder + hoes mad + basic + skill issue + ratio + you fell off + the audacity + triggered + any askers + redpilled + get a life + ok and? + cringe + touch grass + donowalled + not based + your’re a full time discordian + not funny didn’t laugh + you’re* + grammar issue + go outside + get good + your gay + reported + ad hominem + GG! + ur mom + unknown + random + biased + racially motivated + kys + ur unfunny +ratio don’t care + didn’t ask + cry about it + stay mad + get real + L + mald seethe copedon’t care + didn’t ask + cry about it + stay mad + get real + L + mald seethe cope harder + h0es mad + basic + skill issue + ratio + you fell off + the audacity + triggered + any askers + redpilled + get a life + ok and? + cringe + touch grass + donowalled + not based + your’re probably white + not funny didn’t laugh + you’re* + grammar issue + go outside + get good + reported + ad hominem + GG! + ur momdon’t care + didn’t ask + cry about it + stay mad + get real + L + mald seethe cope harder + hoes mad + basic + skill issue + ratio + you fell off + the audacity + triggered + any askers + redpilled + get a life + ok and? + cringe + touch grass + donowalled + not based + your’re a full time discordian + not funny didn’t laugh + you’re* + grammar issue + go outside + get good + your gay + reported + ad hominem + GG! + ur mom + unknown + random + biased + racially motivated + kys + ur unfunny +ratio don’t care + didn’t ask + cry about it + stay mad + get real + so bad + so ass" -y'  # skipcq: FLK-E501
+    command = f'7z t {archive_path} -p"dont care + didnt ask + cry about it + stay mad + get real + L" -y'  # skipcq: FLK-E501
     return "Everything is Ok" in await run_cmds_on_cr(__run_cmds_unzipper, cmd=command)

@@ -66,31 +73,34 @@ async def _extract_with_zstd(path, archive_path):

 # Main function to extract files
 async def extr_files(path, archive_path, password=None):
-    file_path, file_ext = os.path.splitext(archive_path)
-    _, file_ext_inner = os.path.splitext(file_path)
-    tarball_extensions = [
-        '.gz', '.tgz', '.taz',
-        '.bz2', '.tb2', '.tbz', '.tbz2', '.tz2',
-        '.lz',
-        '.lzma', '.tlz',
-        '.lzo',
-        '.xz', '.txz',
-        '.z', '.tz', '.taz',
-        '.zst', '.tzst'
-    ]
-    if file_ext_inner == '.tar' or file_ext in tarball_extensions:
+    os.makedirs(path, exist_ok=True)
+    tarball_extensions = (
+        '.tar.gz', '.gz', '.tgz', '.taz',
+        '.tar.bz2', '.bz2', '.tb2', '.tbz', '.tbz2', '.tz2',
+        '.tar.lz', '.lz',
+        '.tar.lzma', '.lzma', '.tlz',
+        '.tar.lzo', '.lzo',
+        '.tar.xz', '.xz', '.txz',
+        '.tar.z', '.z', '.tz', '.taz'
+    )
+    if archive_path.endswith(tarball_extensions):
+        LOGGER.info("tar")
         temp_path = path.rsplit("/", 1)[0] + "/tar_temp"
         os.makedirs(temp_path, exist_ok=True)
-        result = await _extract_with_7z_helper(temp_path, archive_path, password)
-        filename = os.path.join(temp_path, os.listdir(temp_path)[0])
+        result = await _extract_with_7z_helper(temp_path, archive_path)
+        filename = await get_files(temp_path)
+        filename = filename[0]
         command = f'tar -xvf {shlex.quote(filename)} -C {shlex.quote(path)}'
         result += await run_cmds_on_cr(__run_cmds_unzipper, cmd=command)
         shutil.rmtree(temp_path)
-    elif file_path == ".zst":
+    elif archive_path.endswith(('.tar.zst', '.zst', '.tzst')):
+        LOGGER.info("zstd")
         os.mkdir(path)
         result = await _extract_with_zstd(path, archive_path)
     else:
+        LOGGER.info("normal archive")
         result = await _extract_with_7z_helper(path, archive_path, password)
+    LOGGER.info(await get_files(path))
     await cleanup_macos_artifacts(path)
     return result

@@ -112,12 +122,6 @@ async def merge_files(iinput, ooutput, password=None):
     return await run_cmds_on_cr(__run_cmds_unzipper, cmd=command)

-# Get files in directory as a list
-async def get_files(path):
-    path_list = [val for sublist in [[os.path.join(i[0], j) for j in i[2]] for i in os.walk(path)] for val in sublist]  # skipcq: FLK-E501
-    return sorted(path_list)
-
-
 # Make keyboard
 async def make_keyboard(paths, user_id, chat_id, unziphttp, rzfile=None):
     num = 0
diff --git a/unzipper/modules/ext_script/metadata_helper.py b/unzipper/modules/ext_script/metadata_helper.py
new file mode 100644
index 0000000..25f94b3
--- /dev/null
+++ b/unzipper/modules/ext_script/metadata_helper.py
@@ -0,0 +1,84 @@
+from mutagen.mp3 import MP3
+from mutagen.easyid3 import EasyID3
+from mutagen.mp4 import MP4
+from mutagen.flac import FLAC
+from mutagen.aiff import AIFF
+from mutagen.oggvorbis import OggVorbis
+from mutagen.oggopus import OggOpus
+from mutagen.wave import WAVE
+from mutagen.asf import ASF
+from mutagen.aac import AAC
+
+
+def get_audio_metadata(file_path):
+    file_ext = file_path.split('.')[-1].lower()
+    audio_meta = {
+        'performer': None,
+        'title': None,
+        'duration': None
+    }
+
+    try:
+        if file_ext in ['mp3']:
+            audio = MP3(file_path, ID3=EasyID3)
+        elif file_ext in ['m4a', 'alac']:
+            audio = MP4(file_path)
+        elif file_ext in ['flac']:
+            audio = FLAC(file_path)
+        elif file_ext in ['aif', 'aiff']:
+            audio = AIFF(file_path)
+        elif file_ext in ['ogg']:
+            audio = OggVorbis(file_path)
+        elif file_ext in ['opus']:
+            audio = OggOpus(file_path)
+        elif file_ext in ['wav']:
+            audio = WAVE(file_path)
+        elif file_ext in ['wma']:
+            audio = ASF(file_path)
+        elif file_ext in ['aac']:
+            audio = AAC(file_path)
+        else:
+            return None
+
+        audio_meta['duration'] = int(audio.info.length)
+
+        if file_ext == 'mp3':
+            audio_meta['performer'] = audio.get('artist', [None])[0]
+            audio_meta['title'] = audio.get('title', [None])[0]
+
+        elif file_ext in ['m4a', 'alac']:
+            audio_meta['performer'] = audio.tags.get('\xa9ART', [None])[0]
+            audio_meta['title'] = audio.tags.get('\xa9nam', [None])[0]
+
+        elif file_ext == 'flac':
+            audio_meta['performer'] = audio.get('artist', [None])[0]
+            audio_meta['title'] = audio.get('title', [None])[0]
+
+        elif file_ext in ['aif', 'aiff']:
+            audio_meta['performer'] = audio.get('artist', [None])[0]
+            audio_meta['title'] = audio.get('title', [None])[0]
+
+        elif file_ext == 'ogg':
+            audio_meta['performer'] = audio.get('artist', [None])[0]
+            audio_meta['title'] = audio.get('title', [None])[0]
+
+        elif file_ext == 'opus':
+            audio_meta['performer'] = audio.get('artist', [None])[0]
+            audio_meta['title'] = audio.get('title', [None])[0]
+
+        elif file_ext == 'wav':
+            # WAV doesn't have a standard tagging system, handling might vary
+            pass
+
+        elif file_ext == 'wma':
+            audio_meta['performer'] = audio.tags.get('Author', [None])[0]
+            audio_meta['title'] = audio.tags.get('WM/AlbumTitle', [None])[0]
+
+        elif file_ext == 'aac':
+            # AAC tagging is not standardized, handling might vary
+            pass
+
+    except Exception:
+        return None
+
+    return audio_meta
diff --git a/unzipper/modules/ext_script/up_helper.py b/unzipper/modules/ext_script/up_helper.py
index 6a35154..3b52da6 100644
--- a/unzipper/modules/ext_script/up_helper.py
+++ b/unzipper/modules/ext_script/up_helper.py
@@ -17,6 +17,7 @@ from unzipper.helpers.unzip_help import extentions_list, progress_urls
 from unzipper.helpers.unzip_help import progress_for_pyrogram
 from unzipper.modules.bot_data import Messages
 from unzipper.modules.ext_script.custom_thumbnail import thumb_exists
+#from unzipper.modules.ext_script.metadata_helper import get_audio_metadata

 # To get video duration and thumbnail
@@ -59,14 +60,18 @@ async def send_file(unzip_bot, c_id, doc_f, query, full_path, log_msg, split):
         fname = os.path.basename(doc_f)
         fext = ((pathlib.Path(os.path.abspath(doc_f)).suffix).casefold().replace(".", ""))
         thumbornot = await thumb_exists(c_id)
-        upmsg = await unzipperbot.send_message(c_id, Messages.PROCESSING2)
+        upmsg = await unzipperbot.send_message(c_id, Messages.PROCESSING2, disable_notification=True)
         if ul_mode == "media" and fext in extentions_list["audio"]:
+            #metadata = await get_audio_metadata(doc_f)
             if thumbornot:
                 thumb_image = Config.THUMB_LOCATION + "/" + str(c_id) + ".jpg"
                 await unzip_bot.send_audio(
                     chat_id=c_id,
                     audio=doc_f,
                     caption=Messages.EXT_CAPTION.format(fname),
+                    #duration=metadata['duration'] if metadata else None,
+                    #performer=metadata['performer'] if metadata else None,
+                    #title=metadata['title'] if metadata else None,
                     thumb=thumb_image,
                     disable_notification=True,
                     progress=progress_for_pyrogram,
@@ -82,6 +87,9 @@ async def send_file(unzip_bot, c_id, doc_f, query, full_path, log_msg, split):
                     chat_id=c_id,
                     audio=doc_f,
                     caption=Messages.EXT_CAPTION.format(fname),
+                    #duration=metadata['duration'] if metadata else None,
+                    #performer=metadata['performer'] if metadata else None,
+                    #title=metadata['title'] if metadata else None,
                     disable_notification=True,
                     progress=progress_for_pyrogram,
                     progress_args=(