Music

This Cog contains the bot’s music-playing commands.

Hint

To enable this cog, set the ENABLE_MUSIC variable.

Requirements

Packages

  • The yt-dlp package:

python3 -m install -U yt-dlp
py -m pip install -U yt-dlp

New in version 1.1.0: The yt-dlp package.

Deprecated since version 1.1.0: The use of the youtube-dl package in this bot is deprecated. Backwards compatibility is maintained but installing yt-dlp is recommended.

Programs

  • FFmpeg is used by yt-dlp to extract the audio. Install instructions can be found at ffmpeg.org.

env variables

  • MAX_DURATION indicates the maximum length in seconds a video can have in order to be downloaded. The default is 600 seconds or 10 minutes.

  • MUSIC_DIR indicates where to download the music. Create the directory and set the variable accordingly.

How it works

The bot uses yt-dlp to download the video and extracts the audio using FFmpeg. This means the songs take drive space, which is why MAX_DURATION exists: as a mean to avoid downloading 10-hour long videos unless you really want to.

It also means that playing a song for the first time may take a bit while the download finishes. But if this cache isn’t cleared, the next time the same song is requested there should be no delay in playing it.