From 626c2186641d249e472a1070bdc61a99c077e6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Sun, 18 Apr 2021 17:21:14 +0200 Subject: [PATCH 1/5] added source name to trackToJSON --- .../java/lavalink/server/player/AudioLoaderRestHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java index f58d0f5e4..14aa32500 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java +++ b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.java @@ -72,7 +72,8 @@ private JSONObject trackToJSON(AudioTrack audioTrack) { .put("uri", trackInfo.uri) .put("isStream", trackInfo.isStream) .put("isSeekable", audioTrack.isSeekable()) - .put("position", audioTrack.getPosition()); + .put("position", audioTrack.getPosition()) + .put("sourceName", audioTrack.getSourceManager() == null ? null : audioTrack.getSourceManager().getSourceName()); } private JSONObject encodeLoadResult(LoadResult result) { From fddac16ff1988ec7e96c8a2773d3f1954dac849f Mon Sep 17 00:00:00 2001 From: TopiSenpai Date: Sun, 18 Apr 2021 18:44:58 +0200 Subject: [PATCH 2/5] added sourceName to docu --- IMPLEMENTATION.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index b9701c665..25b3c739a 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -382,7 +382,8 @@ Response: "isStream": false, "position": 0, "title": "Rick Astley - Never Gonna Give You Up", - "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", + "sourceName": "youtube" } } ] From 418c12055405bc230d07a05638ce69c6c7ad6dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Sun, 18 Apr 2021 18:35:42 +0200 Subject: [PATCH 3/5] Docu for /decodetrack & /decodetracks (#477) * added /decodetrack & /decodetracks * Update IMPLEMENTATION.md * fixed code blocks * fixed http method Co-authored-by: Freya Arbjerg * fixed wording Co-authored-by: Freya Arbjerg Co-authored-by: Freya Arbjerg --- IMPLEMENTATION.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 25b3c739a..a046683ce 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -427,6 +427,66 @@ A severity level of `COMMON` indicates that the error is non-fatal and that the } ``` +### Track Decoding API + +Decode a single track into its info +``` +GET /decodetrack?track=QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA== HTTP/1.1 +Host: localhost:8080 +Authorization: youshallnotpass +``` + +Response: +```json +{ + "track": "QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA==", + "info": { + "identifier": "dQw4w9WgXcQ", + "isSeekable": true, + "author": "RickAstleyVEVO", + "length": 212000, + "isStream": false, + "position": 0, + "title": "Rick Astley - Never Gonna Give You Up", + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + } +} +``` + +Decode multiple tracks into info their info +``` +POST /decodetracks HTTP/1.1 +Host: localhost:8080 +Authorization: youshallnotpass +``` + +Request: +```json +[ + "QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA==", + ... +] +``` + +Response: +```json +[ + { + "track": "QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA==", + "info": { + "identifier": "dQw4w9WgXcQ", + "isSeekable": true, + "author": "RickAstleyVEVO", + "length": 212000, + "isStream": false, + "position": 0, + "title": "Rick Astley - Never Gonna Give You Up", + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + } + }, + ... +] +``` --- ### RoutePlanner API From 6ea9ea84dfe2ab0de6028b310c894ed833ba3e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Tue, 20 Apr 2021 00:01:58 +0200 Subject: [PATCH 4/5] Update IMPLEMENTATION.md --- IMPLEMENTATION.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index a046683ce..e5c0fb6e3 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -448,7 +448,8 @@ Response: "isStream": false, "position": 0, "title": "Rick Astley - Never Gonna Give You Up", - "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", + "sourceName": "youtube" } } ``` @@ -481,7 +482,8 @@ Response: "isStream": false, "position": 0, "title": "Rick Astley - Never Gonna Give You Up", - "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", + "sourceName": "youtube" } }, ... From 73c4c4d423693c74cd489bc3c8b45520ebfbe3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Tue, 20 Apr 2021 09:02:46 +0200 Subject: [PATCH 5/5] fix for decodetrack response in docu (#480) # Conflicts: # IMPLEMENTATION.md --- IMPLEMENTATION.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index e5c0fb6e3..916e440a1 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -439,18 +439,15 @@ Authorization: youshallnotpass Response: ```json { - "track": "QAAAjQIAJVJpY2sgQXN0bGV5IC0gTmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXAADlJpY2tBc3RsZXlWRVZPAAAAAAADPCAAC2RRdzR3OVdnWGNRAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9ZFF3NHc5V2dYY1EAB3lvdXR1YmUAAAAAAAAAAA==", - "info": { - "identifier": "dQw4w9WgXcQ", - "isSeekable": true, - "author": "RickAstleyVEVO", - "length": 212000, - "isStream": false, - "position": 0, - "title": "Rick Astley - Never Gonna Give You Up", - "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", - "sourceName": "youtube" - } + "identifier": "dQw4w9WgXcQ", + "isSeekable": true, + "author": "RickAstleyVEVO", + "length": 212000, + "isStream": false, + "position": 0, + "title": "Rick Astley - Never Gonna Give You Up", + "uri": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", + "sourceName": "youtube" } ```