From eaef4754109eeb263ebe638c4d02005902c1fa45 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Sun, 9 Jul 2017 15:03:16 -0500 Subject: [PATCH] Use predownloaded info for filename --- cogs/voice_utilities/source.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogs/voice_utilities/source.py b/cogs/voice_utilities/source.py index 56c20f7..3a5c84d 100644 --- a/cogs/voice_utilities/source.py +++ b/cogs/voice_utilities/source.py @@ -15,7 +15,6 @@ class YoutubeDLSource(discord.FFmpegPCMAudio): self.info = None self.ready = False self.error = False - asyncio.run_coroutine_threadsafe(self.download(), self.loop) async def get_info(self): try: @@ -64,6 +63,7 @@ class YoutubeDLSource(discord.FFmpegPCMAudio): async def prepare(self): await self.get_info() + asyncio.run_coroutine_threadsafe(self.download(), self.loop) return self.info async def download(self): @@ -78,7 +78,7 @@ class YoutubeDLSource(discord.FFmpegPCMAudio): 'before_options': '-nostdin', 'options': '-vn -b:a 128k' } - super().__init__(self.downloader.ytdl.prepare_filename(result), **opts) + super().__init__(self.downloader.ytdl.prepare_filename(self.info), **opts) @property def title(self):