aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/music/play_commands.py
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-04-19 15:43:32 +0200
committersalmonik <raisersoft@proton.me>2026-04-19 15:43:32 +0200
commit1dcdbe3cf03ff16b3ff2e2e6d572e0b3c72c18c0 (patch)
treef11dc45777d8b3c8ff0e2ca16be83f85b272bd48 /cogs/music/play_commands.py
parenttest: add cron tests + improve existing tests (diff)
downloadsenator-sperma-1dcdbe3cf03ff16b3ff2e2e6d572e0b3c72c18c0.tar.gz
senator-sperma-1dcdbe3cf03ff16b3ff2e2e6d572e0b3c72c18c0.zip
refactor: simplify cogs, reduce complexity
- Remove unused imports and dead code - Cleaner error handling - Reduce cognitive complexity
Diffstat (limited to 'cogs/music/play_commands.py')
-rw-r--r--cogs/music/play_commands.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cogs/music/play_commands.py b/cogs/music/play_commands.py
index fd5113a..a82fa9d 100644
--- a/cogs/music/play_commands.py
+++ b/cogs/music/play_commands.py
@@ -6,6 +6,7 @@
6import logging 6import logging
7import os 7import os
8import urllib.parse 8import urllib.parse
9import asyncio
9from os import PathLike 10from os import PathLike
10from typing import Awaitable, Callable, List, Tuple 11from typing import Awaitable, Callable, List, Tuple
11 12
@@ -139,9 +140,10 @@ class PlayCommands(commands.Cog):
139 local_path = os.path.join(self.temp_dir, filename) 140 local_path = os.path.join(self.temp_dir, filename)
140 os.makedirs(self.temp_dir, exist_ok=True) 141 os.makedirs(self.temp_dir, exist_ok=True)
141 142
143 loop = asyncio.get_event_loop()
142 with open(local_path, "wb") as f: 144 with open(local_path, "wb") as f:
143 async for chunk in response.content.iter_chunked(8192): 145 async for chunk in response.content.iter_chunked(8192):
144 f.write(chunk) 146 await loop.run_in_executor(None, f.write, chunk)
145 147
146 compressed_path = await media_processing.AudioCompressor.compress( 148 compressed_path = await media_processing.AudioCompressor.compress(
147 ctx, local_path 149 ctx, local_path