From f4804276d923eca5749ed05d7ab33e50e2ad6b6c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 11 Mar 2018 18:23:18 +0100 Subject: [PATCH] Fix player ignoring existing songs --- discordbot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discordbot.py b/discordbot.py index 9e4e8a36..647e7de1 100644 --- a/discordbot.py +++ b/discordbot.py @@ -56,6 +56,8 @@ class Video: info = info["entries"][0] file_id = info.get("title", str(hash(self.ytdl_url))) file_id = re.sub(r"(?:\/|\\|\?|\*|\"|<|>|\||:)", "_", file_id) + # Set the filename to the downloaded video + self.filename = file_id if os.path.exists(f"opusfiles/{file_id}.opus"): return if info.get("duration", 1) > int(config["YouTube"]["max_duration"]): @@ -75,8 +77,6 @@ class Video: # Download the video with youtube_dl.YoutubeDL(ytdl_args) as ytdl: await loop.run_in_executor(executor, functools.partial(ytdl.download, [self.ytdl_url])) - # Set the filename to the downloaded video - self.filename = file_id if __debug__: