Fix build_track failure with Lavalink v4 decodetrack format.
This commit is contained in:
parent
179472bd6e
commit
6817cd8e07
|
|
@ -10,6 +10,7 @@ build/
|
||||||
Pipfile.lock
|
Pipfile.lock
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.idea/
|
||||||
.venv/
|
.venv/
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
*.ini
|
*.ini
|
||||||
|
|
|
||||||
|
|
@ -545,11 +545,19 @@ class Node:
|
||||||
path="decodetrack",
|
path="decodetrack",
|
||||||
query=f"encodedTrack={quote(identifier)}",
|
query=f"encodedTrack={quote(identifier)}",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if self._version.major >= 4:
|
||||||
|
track_info = data["info"]
|
||||||
|
track_type = data["info"]["sourceName"]
|
||||||
|
else:
|
||||||
|
track_info = data
|
||||||
|
track_type = data["sourceName"]
|
||||||
|
|
||||||
return Track(
|
return Track(
|
||||||
track_id=identifier,
|
track_id=identifier,
|
||||||
ctx=ctx,
|
ctx=ctx,
|
||||||
info=data,
|
info=track_info,
|
||||||
track_type=TrackType(data["sourceName"]),
|
track_type=TrackType(track_type),
|
||||||
)
|
)
|
||||||
|
|
||||||
async def get_tracks(
|
async def get_tracks(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue