diff options
Diffstat (limited to 'cogs/music/play_commands.py')
| -rw-r--r-- | cogs/music/play_commands.py | 4 |
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 @@ | |||
| 6 | import logging | 6 | import logging |
| 7 | import os | 7 | import os |
| 8 | import urllib.parse | 8 | import urllib.parse |
| 9 | import asyncio | ||
| 9 | from os import PathLike | 10 | from os import PathLike |
| 10 | from typing import Awaitable, Callable, List, Tuple | 11 | from 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 |
