From c9d12ad9e30fd08f641c555d37cd2f4173acd9c6 Mon Sep 17 00:00:00 2001 From: BarsTiger Date: Fri, 16 Apr 2021 15:00:09 +0300 Subject: [PATCH] 1 --- main.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index e38369d..80c80b9 100644 --- a/main.py +++ b/main.py @@ -46,8 +46,12 @@ ffmpeg_options = { 'options': '-vn' } +ffmpeg_super_bass_options = { + 'options': '-af "equalizer=f=160:width_type=o:width=1:g=10, equalizer=f=30:width_type=o:width=1:g=5, equalizer=f=50:width_type=o:width=1:g=5"' +} + ffmpeg_bass_options = { - 'options': '-af "firequalizer=gain_entry="entry(0,-8);entry(250,4);entry(1000,-8);entry(4000,0);entry(16000,-8)""' + 'options': '-af "equalizer=f=160:width_type=o:width=1:g=10, equalizer=f=30:width_type=o:width=1:g=3, equalizer=f=50:width_type=o:width=1:g=3"' } ytdl = youtube_dl.YoutubeDL(ytdl_format_options) @@ -74,6 +78,29 @@ class YTDLSource(discord.PCMVolumeTransformer): filename = data['url'] if stream else ytdl.prepare_filename(data) return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data) + @classmethod + async def bass_from_url(cls, url, *, loop=None, stream=False): + loop = loop or asyncio.get_event_loop() + data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream)) + + if 'entries' in data: + # take first item from a playlist + data = data['entries'][0] + + filename = data['url'] if stream else ytdl.prepare_filename(data) + return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_bass_options), data=data) + + @classmethod + async def superbass_from_url(cls, url, *, loop=None, stream=False): + loop = loop or asyncio.get_event_loop() + data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream)) + + if 'entries' in data: + # take first item from a playlist + data = data['entries'][0] + + filename = data['url'] if stream else ytdl.prepare_filename(data) + return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_super_bass_options), data=data) class Music(commands.Cog): def __init__(self, bot):