From 443eec8320f91f637eee068182ca0f3c5e2cdfb5 Mon Sep 17 00:00:00 2001 From: Lukas Blacha Date: Wed, 8 Feb 2023 17:42:53 +0100 Subject: [PATCH] Added cores flag for Startup --- Music-Bot.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Music-Bot.py b/Music-Bot.py index ba9a49c..2464e4b 100644 --- a/Music-Bot.py +++ b/Music-Bot.py @@ -28,8 +28,16 @@ cache_dir = "cache" logging.basicConfig(level=logging.INFO) parser = argparse.ArgumentParser() parser.add_argument("-t", "--token", help="Bot TOKEN") +parser.add_argument("-c", "--cores", help="Number of Cores for ffmpeg (Standard 2)") args = parser.parse_args() + +if args.cores == None: + threads = 2 +else: + threads = int(args.cores) + + if args.token == None: print(f"{banner}\n\nPLEASE PROVIDE BOT A TOKEN BY RUNNING LIKE THE FOLLOWING:") print("\n") @@ -85,7 +93,7 @@ else: filename = data["url"] if stream else ytdl.prepare_filename(data) return cls(discord.FFmpegPCMAudio(source=filename, executable="ffmpeg", pipe=False, stderr=False, - before_options="-threads 2", options=ffmpeg_options), data=data) + before_options=f"-threads {threads}", options=ffmpeg_options), data=data) async def youtube_search(search: str): @@ -115,6 +123,7 @@ else: print(banner) print(f"Bot Version: {version} ({branch})") print(f"Bot: {bot.user} (ID: {bot.user.id})") + print(f"Threads for ffmpeg: {threads}") print( f"Invitation LINK: https://discord.com/api/oauth2/authorize?client_id={bot.user.id}&permissions=968552344896&scope=bot%20applications.commands") print("------")