diff --git a/changelog.d/audio/3337.misc.1.rst b/changelog.d/audio/3337.misc.1.rst new file mode 100644 index 000000000..f39071842 --- /dev/null +++ b/changelog.d/audio/3337.misc.1.rst @@ -0,0 +1 @@ +Removed a duplication of track search prefixes. \ No newline at end of file diff --git a/changelog.d/audio/3337.misc.2.rst b/changelog.d/audio/3337.misc.2.rst new file mode 100644 index 000000000..25985f91d --- /dev/null +++ b/changelog.d/audio/3337.misc.2.rst @@ -0,0 +1 @@ +Changed and handled the `V2_COMPACT` LoadType to use the correct `V2_COMPAT` type. \ No newline at end of file diff --git a/redbot/cogs/audio/apis.py b/redbot/cogs/audio/apis.py index 5bc359efc..d949be375 100644 --- a/redbot/cogs/audio/apis.py +++ b/redbot/cogs/audio/apis.py @@ -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: diff --git a/redbot/cogs/audio/audio.py b/redbot/cogs/audio/audio.py index 67607f090..bbbf1852c 100644 --- a/redbot/cogs/audio/audio.py +++ b/redbot/cogs/audio/audio.py @@ -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( diff --git a/redbot/cogs/audio/audio_dataclasses.py b/redbot/cogs/audio/audio_dataclasses.py index 7b1ca769e..d31cbbc9b 100644 --- a/redbot/cogs/audio/audio_dataclasses.py +++ b/redbot/cogs/audio/audio_dataclasses.py @@ -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():