[3.2.3][Audio] Full fix for #3328 (#3355)

* Limit Playlists

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

* Hotfix

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

* Hotfix

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

* [Audio] Hotfix an edge case where an attribute error can be raised (#3328)

* Limit Playlists

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

* Hotfix

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

* Hotfix

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

* flame's review

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

* Delete 3328.hotfix.1.rst

* lets be extra safe here

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
This commit is contained in:
Draper
2020-01-12 22:37:50 +00:00
committed by Michael H
parent d6936c87f3
commit fdfbfe7b60
3 changed files with 46 additions and 34 deletions

View File

@@ -246,14 +246,19 @@ class Audio(commands.Cog):
uri = t.get("info", {}).get("uri")
if uri:
t = {"loadType": "V2_COMPACT", "tracks": [t], "query": uri}
database_entries.append(
{
"query": uri,
"data": json.dumps(t),
"last_updated": time_now,
"last_fetched": time_now,
}
)
data = json.dumps(t)
if all(
k in data
for k in ["loadType", "playlistInfo", "isSeekable", "isStream"]
):
database_entries.append(
{
"query": uri,
"data": data,
"last_updated": time_now,
"last_fetched": time_now,
}
)
await asyncio.sleep(0)
if guild_playlist:
all_playlist[str(guild_id)] = guild_playlist
@@ -5883,14 +5888,16 @@ class Audio(commands.Cog):
uri = t.get("info", {}).get("uri")
if uri:
t = {"loadType": "V2_COMPACT", "tracks": [t], "query": uri}
database_entries.append(
{
"query": uri,
"data": json.dumps(t),
"last_updated": time_now,
"last_fetched": time_now,
}
)
data = json.dumps(t)
if all(k in data for k in ["loadType", "playlistInfo", "isSeekable", "isStream"]):
database_entries.append(
{
"query": uri,
"data": data,
"last_updated": time_now,
"last_fetched": time_now,
}
)
if database_entries:
await self.music_cache.database.insert("lavalink", database_entries)