Merge branch '8-video-inappropriate' into 'develop'

Fix age-restricted songs not playable

Closes #8

See merge request ekzyis/musicube!7
This commit is contained in:
Ramdip Gill 2021-09-25 18:11:49 +00:00
commit 80041b22ef
3 changed files with 8 additions and 5 deletions

View File

@ -1 +1,2 @@
BOT_TOKEN=
DISCORD_BOT_TOKEN=
YOUTUBE_COOKIES=

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ venv
__pycache__
.env
.coverage
*cookies.txt

View File

@ -20,7 +20,8 @@ class Music(commands.Cog):
self._bot = bot
self._queue = asyncio.Queue()
self._queue_lock = asyncio.Lock()
self._ytdl_format_options = {
self._ytdl_params = {
'cookiefile': os.environ.get('YOUTUBE_COOKIES'),
'format': 'bestaudio/best',
'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
'restrictfilenames': True,
@ -36,7 +37,7 @@ class Music(commands.Cog):
self._ffmpeg_options = {
'options': '-vn'
}
self._ytdl = youtube_dl.YoutubeDL(self._ytdl_format_options)
self._ytdl = youtube_dl.YoutubeDL(self._ytdl_params)
# pylint: disable=no-member
self._handle_playback.start()
@ -99,9 +100,9 @@ if __name__ == "__main__":
bot.add_cog(Music(bot))
bot.add_cog(ErrorHandler(bot))
token = os.environ.get("BOT_TOKEN", None)
token = os.environ.get("DISCORD_BOT_TOKEN", None)
if not token:
print("No token found in BOT_TOKEN")
print("Discord bot token not found")
sys.exit(1)
bot.run(token)