aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/music/play_compressed.py
diff options
context:
space:
mode:
authorSamlon <stankiewiczgracjan2019@gmail.com>2025-08-11 17:39:21 +0200
committerSamlon <stankiewiczgracjan2019@gmail.com>2025-08-11 17:39:21 +0200
commitca0b4ecf005e1c1f4066460a45393ebffef1ef1c (patch)
tree4c175ba876ae35d9248dfab33d2a981fe3cfb207 /cogs/music/play_compressed.py
parentchanged printing to proper logging (diff)
downloadsenator-sperma-ca0b4ecf005e1c1f4066460a45393ebffef1ef1c.tar.gz
senator-sperma-ca0b4ecf005e1c1f4066460a45393ebffef1ef1c.zip
more logging
Diffstat (limited to 'cogs/music/play_compressed.py')
-rw-r--r--cogs/music/play_compressed.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/cogs/music/play_compressed.py b/cogs/music/play_compressed.py
index 038a15e..dd8dfd8 100644
--- a/cogs/music/play_compressed.py
+++ b/cogs/music/play_compressed.py
@@ -31,6 +31,7 @@ class GrajcujZkompresowane(commands.Cog):
31 output_path = f"{base}_compressed.opus" 31 output_path = f"{base}_compressed.opus"
32 ffmpeg_command = f"ffmpeg -i {input_path} -ac 1 -b:a 500 -acodec libopus {output_path}" 32 ffmpeg_command = f"ffmpeg -i {input_path} -ac 1 -b:a 500 -acodec libopus {output_path}"
33 subprocess.run(ffmpeg_command, check=True, shell=True) 33 subprocess.run(ffmpeg_command, check=True, shell=True)
34 logger.info(f"Audio compressed to {output_path}")
34 return output_path 35 return output_path
35 36
36 @commands.slash_command(name="grajcuj_zkompresowane", description="grajcuj zkompresowane melodyje") 37 @commands.slash_command(name="grajcuj_zkompresowane", description="grajcuj zkompresowane melodyje")
@@ -38,10 +39,12 @@ class GrajcujZkompresowane(commands.Cog):
38 await ctx.defer() 39 await ctx.defer()
39 if not (ctx.author.voice and ctx.author.voice.channel): 40 if not (ctx.author.voice and ctx.author.voice.channel):
40 await ctx.followup.send("nie jesteś w kanale głosowym") 41 await ctx.followup.send("nie jesteś w kanale głosowym")
42 logger.info("User is not in a voice channel")
41 return 43 return
42 channel = ctx.author.voice.channel 44 channel = ctx.author.voice.channel
43 if ctx.voice_client is not None: 45 if ctx.voice_client is not None:
44 vc = ctx.voice_client 46 vc = ctx.voice_client
47 logger.info(f"User is already in a voice channel, moving to new {channel}")
45 await vc.move_to(channel) 48 await vc.move_to(channel)
46 else: 49 else:
47 vc = await channel.connect() 50 vc = await channel.connect()
@@ -81,6 +84,7 @@ class GrajcujZkompresowane(commands.Cog):
81 compressed_file_path = self.compress_audio(file_path) 84 compressed_file_path = self.compress_audio(file_path)
82 except subprocess.CalledProcessError as e: 85 except subprocess.CalledProcessError as e:
83 await ctx.followup.send(f"skompresowanie nie powiodło się: {str(e)}", ephemeral=True) 86 await ctx.followup.send(f"skompresowanie nie powiodło się: {str(e)}", ephemeral=True)
87 logger.error(f"Failed to compress audio: {e}", exc_info=True)
84 return 88 return
85 found_file = compressed_file_path 89 found_file = compressed_file_path
86 found_title = title 90 found_title = title
@@ -99,6 +103,7 @@ class GrajcujZkompresowane(commands.Cog):
99 vc.stop() 103 vc.stop()
100 vc.play(discord.FFmpegPCMAudio(found_file), after=after_playing) 104 vc.play(discord.FFmpegPCMAudio(found_file), after=after_playing)
101 await ctx.followup.send(f"gra (zkompresowane): {title}") 105 await ctx.followup.send(f"gra (zkompresowane): {title}")
106 logger.info(f"Playing audio: {title}")
102 107
103 108
104def setup(bot): 109def setup(bot):