From ca0b4ecf005e1c1f4066460a45393ebffef1ef1c Mon Sep 17 00:00:00 2001 From: Samlon Date: Mon, 11 Aug 2025 17:39:21 +0200 Subject: more logging --- cogs/compression.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cogs/compression.py') diff --git a/cogs/compression.py b/cogs/compression.py index ddfa545..75eaf7c 100644 --- a/cogs/compression.py +++ b/cogs/compression.py @@ -4,7 +4,9 @@ import subprocess import discord from discord.ext import commands +import logging +logger = logging.getLogger(__name__) def filetype(filename): mime_type, _ = mimetypes.guess_type(filename) @@ -45,6 +47,7 @@ class Compression(commands.Cog): input_path = file_path output_path = os.path.join(temp_dir, f"better_{plik.filename}") file_type = filetype(file_path) + logger.info(f"Compression started for: {file_type}") if file_type == "Video": # Execute ffmpeg command to compress video ffmpeg_command = f"ffmpeg -i {input_path} -c:v libx264 -crf 51 -b:v 100 -vf 'fps=10' -preset ultrafast -c:a libopus -b:a 500 {output_path}" @@ -68,12 +71,14 @@ class Compression(commands.Cog): ffmpeg_command = img_command else: await ctx.respond("Plik jest nieobsługiwany", ephemeral=True) + logger.info("Unsupported file type") return try: subprocess.run(ffmpeg_command, check=True, shell=True) # Upload the compressed file await ctx.respond(file=discord.File(output_path)) + logger.info(f"Compression completed for: {file_type}") # Delete compressed file os.remove(input_path) os.remove(output_path) -- cgit v1.2.3