[3.2]Audio] some hotfixes to avoid crashing the bot (#3286)

* Add a command to toggle daily queues, and  restrict playlist length to 10k tracks and try to avoid some blocking calls

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Add a command to toggle daily queues, and  restrict playlist length to 10k tracks and try to avoid some blocking calls

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* indents

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* *sigh* forgot single tracks

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* formatting plus some other fixes

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* formatting plus some other fixes

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
This commit is contained in:
Draper
2020-01-08 22:04:52 +00:00
committed by Michael H
parent 965416de73
commit 44e680ee41
4 changed files with 312 additions and 127 deletions

View File

@@ -1,3 +1,4 @@
import asyncio
from collections import namedtuple
from typing import List, MutableMapping, Optional, Union, TYPE_CHECKING
@@ -478,12 +479,16 @@ async def get_all_playlist(
playlists = await database.fetch_all(scope_standard, scope_id, author_id=user_id)
else:
playlists = await database.fetch_all(scope_standard, scope_id)
return [
await Playlist.from_json(
bot, scope, playlist.playlist_id, playlist, guild=guild, author=author
playlist_list = []
for playlist in playlists:
playlist_list.append(
await Playlist.from_json(
bot, scope, playlist.playlist_id, playlist, guild=guild, author=author
)
)
for playlist in playlists
]
await asyncio.sleep(0)
return playlist_list
async def get_all_playlist_converter(
@@ -524,12 +529,15 @@ async def get_all_playlist_converter(
playlists = await database.fetch_all_converter(
scope_standard, playlist_name=arg, playlist_id=arg
)
return [
await Playlist.from_json(
bot, scope, playlist.playlist_id, playlist, guild=guild, author=author
playlist_list = []
for playlist in playlists:
playlist_list.append(
await Playlist.from_json(
bot, scope, playlist.playlist_id, playlist, guild=guild, author=author
)
)
for playlist in playlists
]
await asyncio.sleep(0)
return playlist_list
async def create_playlist(