diff options
Diffstat (limited to '')
| -rw-r--r-- | cogs/music/play_compressed.py | 9 |
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 @@ | |||
| 1 | import asyncio | 1 | import asyncio |
| 2 | import logging | ||
| 2 | import os | 3 | import os |
| 3 | import subprocess | 4 | import subprocess |
| 4 | 5 | ||
| @@ -6,6 +7,8 @@ import discord | |||
| 6 | from discord.ext import commands | 7 | from discord.ext import commands |
| 7 | from youtubesearchpython import VideosSearch | 8 | from youtubesearchpython import VideosSearch |
| 8 | 9 | ||
| 10 | logger = logging.getLogger(__name__) | ||
| 11 | |||
| 9 | 12 | ||
| 10 | class GrajcujZkompresowane(commands.Cog): | 13 | class 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() |
