mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 03:38:53 -05:00
[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:
parent
81b6d5bb93
commit
7bdd177713
1
changelog.d/audio/3337.misc.1.rst
Normal file
1
changelog.d/audio/3337.misc.1.rst
Normal file
@ -0,0 +1 @@
|
||||
Removed a duplication of track search prefixes.
|
||||
1
changelog.d/audio/3337.misc.2.rst
Normal file
1
changelog.d/audio/3337.misc.2.rst
Normal file
@ -0,0 +1 @@
|
||||
Changed and handled the `V2_COMPACT` LoadType to use the correct `V2_COMPAT` type.
|
||||
@ -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:
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user