aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/music/play_compressed.py
diff options
context:
space:
mode:
authorSamlon <stankiewiczgracjan2019@gmail.com>2025-08-11 17:16:33 +0200
committerSamlon <stankiewiczgracjan2019@gmail.com>2025-08-11 17:16:33 +0200
commit0eb1a48fca5668c7c5c35ef81d247b4511d8e78a (patch)
tree1ac1ed8f62ac0d641b6527141afd6f06eb3f8ade /cogs/music/play_compressed.py
parentfixing not working skip (diff)
downloadsenator-sperma-0eb1a48fca5668c7c5c35ef81d247b4511d8e78a.tar.gz
senator-sperma-0eb1a48fca5668c7c5c35ef81d247b4511d8e78a.zip
changed printing to proper logging
Diffstat (limited to '')
-rw-r--r--cogs/music/play_compressed.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/cogs/music/play_compressed.py b/cogs/music/play_compressed.py
index 0d4901c..038a15e 100644
--- a/cogs/music/play_compressed.py
+++ b/cogs/music/play_compressed.py
@@ -1,4 +1,5 @@
1import asyncio 1import asyncio
2import logging
2import os 3import os
3import subprocess 4import subprocess
4 5
@@ -6,6 +7,8 @@ import discord
6from discord.ext import commands 7from discord.ext import commands
7from youtubesearchpython import VideosSearch 8from youtubesearchpython import VideosSearch
8 9
10logger = logging.getLogger(__name__)
11
9 12
10class GrajcujZkompresowane(commands.Cog): 13class GrajcujZkompresowane(commands.Cog):
11 def __init__(self, bot): 14 def __init__(self, bot):
@@ -20,7 +23,7 @@ class GrajcujZkompresowane(commands.Cog):
20 modified.write(f"{title}\n".encode('utf-8')) 23 modified.write(f"{title}\n".encode('utf-8'))
21 modified.write(data) 24 modified.write(data)
22 except Exception as e: 25 except Exception as e:
23 print(f"Failed to prepend title: {e}") 26 logger.error(f"Failed to prepend title: {e}", exc_info=True)
24 27
25 @staticmethod 28 @staticmethod
26 def compress_audio(input_path): 29 def compress_audio(input_path):
@@ -84,13 +87,13 @@ class GrajcujZkompresowane(commands.Cog):
84 title = found_title 87 title = found_title
85 def after_playing(error): 88 def after_playing(error):
86 if error: 89 if error:
87 print(f'Player error: {error}') 90 logger.error(f'Player error: {error}')
88 coro = vc.disconnect() 91 coro = vc.disconnect()
89 fut = asyncio.run_coroutine_threadsafe(coro, self.bot.loop) 92 fut = asyncio.run_coroutine_threadsafe(coro, self.bot.loop)
90 try: 93 try:
91 fut.result() 94 fut.result()
92 except Exception as e: 95 except Exception as e:
93 print(f'Error disconnecting: {e}') 96 logger.error(f'Error disconnecting: {e}', exc_info=True)
94 97
95 if vc.is_playing() or vc.is_paused(): 98 if vc.is_playing() or vc.is_paused():
96 vc.stop() 99 vc.stop()