From 6d8c86d7683e18cdc62370c479a9db24cc8b100c Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 7 Apr 2018 19:18:18 -0400 Subject: Add list queued support --- src/main/java/soundchan/TrackScheduler.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main/java/soundchan/TrackScheduler.java') diff --git a/src/main/java/soundchan/TrackScheduler.java b/src/main/java/soundchan/TrackScheduler.java index 7f1c258..21bb6d4 100644 --- a/src/main/java/soundchan/TrackScheduler.java +++ b/src/main/java/soundchan/TrackScheduler.java @@ -2,9 +2,14 @@ package soundchan; import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter; +import com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack; import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason; +import com.sedmelluq.discord.lavaplayer.track.DelegatedAudioTrack; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; @@ -37,6 +42,17 @@ public class TrackScheduler extends AudioEventAdapter { } } + public List getQueueContents() { + // Returns a list of the tracks in the queue + Object[] queueInfo = queue.toArray(); + List tracks = new ArrayList<>(); + for (Object item: + queueInfo) { + tracks.add(((DelegatedAudioTrack) item).getInfo().title); + } + return tracks; + } + /** * Start the next track, stopping the current one if it is playing. */ -- cgit v1.2.3