Skip to content

Commit

Permalink
Merge pull request #815 from freyacodes/dev
Browse files Browse the repository at this point in the history
v3.7.3 release
  • Loading branch information
topi314 authored Jan 23, 2023
2 parents 338497c + 97ff80f commit 702bb8d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Each release usually includes various fixes and improvements.
The most noteworthy of these, as well as any features and breaking changes, are listed here.

## 3.7.3
* Fix breaking change where `/decodetrack` would return a full track instead of the track info

## 3.7.2
* Fix breaking change where frameStats would be null instead of omitted

Expand Down
14 changes: 11 additions & 3 deletions IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1169,15 +1169,14 @@ GET /v3/decodetrack?encodedTrack=BASE64

Response:

[Track Object](#track)
[Track Object](#track) and [Track Info Object](#track-info) for pre v3.7 compatibility.

<details>
<summary>Example Payload</summary>

```yaml
{
"encoded": "QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA==",
"track": "...", # Same as encoded, removed in /v4
"info": {
"identifier": "dQw4w9WgXcQ",
"isSeekable": true,
Expand All @@ -1188,7 +1187,16 @@ Response:
"title": "Rick Astley - Never Gonna Give You Up",
"uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"sourceName": "youtube"
}
},
"identifier": "dQw4w9WgXcQ", // Same as info.identifier, removed in /v4
"isSeekable": true, // Same as info.isSeekable, removed in /v4
"author": "RickAstleyVEVO", // Same as info.author, removed in /v4
"length": 212000, // Same as info.length, removed in /v4
"isStream": false, // Same as info.isStream, removed in /v4
"position": 0, // Same as info.position, removed in /v4
"title": "Rick Astley - Never Gonna Give You Up", // Same as info.title, removed in /v4
"uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", // Same as info.uri, removed in /v4
"sourceName": "youtube" // Same as info.sourceName, removed in /v4
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.JsonNodeFactory
import com.fasterxml.jackson.databind.node.ObjectNode
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager
import dev.arbjerg.lavalink.protocol.v3.DecodedTrack
import dev.arbjerg.lavalink.protocol.v3.Track
import dev.arbjerg.lavalink.protocol.v3.TrackInfo
import dev.arbjerg.lavalink.protocol.v3.decodeTrack
import lavalink.server.util.toTrack
import org.slf4j.LoggerFactory
Expand Down Expand Up @@ -70,12 +72,13 @@ class AudioLoaderRestHandler(
}

@GetMapping(value = ["/decodetrack", "/v3/decodetrack"])
fun getDecodeTrack(@RequestParam encodedTrack: String?, @RequestParam track: String?): ResponseEntity<Track> {
fun getDecodeTrack(@RequestParam encodedTrack: String?, @RequestParam track: String?): ResponseEntity<DecodedTrack> {
val trackToDecode = encodedTrack ?: track ?: throw ResponseStatusException(
HttpStatus.BAD_REQUEST,
"No track to decode provided"
)
return ResponseEntity.ok(decodeTrack(audioPlayerManager, trackToDecode).toTrack(trackToDecode))
val decodedTrack = decodeTrack(audioPlayerManager, trackToDecode).toTrack(trackToDecode)
return ResponseEntity.ok(DecodedTrack(decodedTrack.encoded, decodedTrack.info, decodedTrack.info))
}

@PostMapping(value = ["/decodetracks", "/v3/decodetracks"])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.arbjerg.lavalink.protocol.v3

import com.fasterxml.jackson.annotation.JsonUnwrapped
import com.fasterxml.jackson.annotation.JsonValue
import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.DeserializationContext
Expand All @@ -21,6 +22,13 @@ data class Player(
val filters: Filters
)

data class DecodedTrack(
val encoded: String,
val info: TrackInfo,
@JsonUnwrapped
val oldInfo: TrackInfo
)

data class Track(
val encoded: String,
val track: String,
Expand Down

0 comments on commit 702bb8d

Please sign in to comment.