Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix track decoding API calls #157

Merged
merged 5 commits into from
Feb 8, 2024
Merged

Fix track decoding API calls #157

merged 5 commits into from
Feb 8, 2024

Conversation

MagicalJellyfish
Copy link
Contributor

  • Added DecodedLavaTrack class, which represents the JSON object returned by GET /v4/decodetrack and the elements in the array returned by POST /v4/decodetracks
  • Changed types in LavaNode.DecodeTrackAsync and LavaNode.DecodeTracksAsync to use and return DecodedLavaTrack
  • Added Url-encoding in LavaNode.DecodeTrackAsync
  • Changed target Url of LavaNode.DecodeTracksAsync http-request as indicated by Lavalink docs

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must we add another LavaTrack? My idea was to use TrackDeserializer to des the response into LavaTrack

ArgumentNullException.ThrowIfNull(trackHash);
var responseMessage = await _httpClient.GetAsync($"/{_version}/decodetrack?encodedTrack={trackHash}");
var responseMessage = await _httpClient.GetAsync($"/{_version}/decodetrack?encodedTrack={HttpUtility.UrlEncode(trackHash)}");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't trackHash already an encoded string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least on both TrackEndEventArg and TrackStartEventArg, encodedTrack isn't URL-safe.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Track obj

public object PluginInfo { get; internal set; }

src/LavaNode.cs Outdated Show resolved Hide resolved
@Yucked Yucked merged commit a8df08c into Yucked:v7 Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants