[3.2.3][Audio] Correct an unsupported LoadType (#3337)

* Limit Playlists

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

* logging improvements

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

* logging improvements

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

* sigh

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

* chore

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
This commit is contained in:
Draper 2020-01-12 23:35:49 +00:00 committed by Michael H
parent 81b6d5bb93
commit 7bdd177713
5 changed files with 12 additions and 2 deletions

View File

@ -0,0 +1 @@
Removed a duplication of track search prefixes.

View File

@ -0,0 +1 @@
Changed and handled the `V2_COMPACT` LoadType to use the correct `V2_COMPAT` type.

View File

@ -755,6 +755,8 @@ class MusicCache:
if val and not forced and isinstance(val, dict):
data = val
data["query"] = query
if data.get("loadType") == "V2_COMPACT":
data["loadType"] = "V2_COMPAT"
results = LoadResult(data)
called_api = False
if results.has_error:
@ -863,6 +865,8 @@ class MusicCache:
if recently_played:
track = random.choice(recently_played)
if track.get("loadType") == "V2_COMPACT":
track["loadType"] = "V2_COMPAT"
results = LoadResult(track)
tracks = list(results.tracks)
except Exception:

View File

@ -245,7 +245,7 @@ class Audio(commands.Cog):
for t in tracks_in_playlist:
uri = t.get("info", {}).get("uri")
if uri:
t = {"loadType": "V2_COMPACT", "tracks": [t], "query": uri}
t = {"loadType": "V2_COMPAT", "tracks": [t], "query": uri}
data = json.dumps(t)
if all(
k in data
@ -5905,7 +5905,7 @@ class Audio(commands.Cog):
for t in track_list:
uri = t.get("info", {}).get("uri")
if uri:
t = {"loadType": "V2_COMPACT", "tracks": [t], "query": uri}
t = {"loadType": "V2_COMPAT", "tracks": [t], "query": uri}
data = json.dumps(t)
if all(k in data for k in ["loadType", "playlistInfo", "isSeekable", "isStream"]):
database_entries.append(

View File

@ -378,6 +378,10 @@ class Query:
if isinstance(query, str):
query = query.strip("<>")
while "ytsearch:" in query:
query = query.replace("ytsearch:", "")
while "scsearch:" in query:
query = query.replace("scsearch:", "")
elif isinstance(query, Query):
for key, val in kwargs.items():