Correct Playlist order when added on top

This commit is contained in:
BrokenFire 2018-01-12 23:50:13 +01:00
parent 3d661951bd
commit 4e0cceb508
2 changed files with 11 additions and 7 deletions

View File

@ -22,6 +22,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class AudioM { public class AudioM {
@ -108,6 +109,10 @@ public class AudioM {
public void playListLoader(AudioPlaylist playlist,int playlistLimit, boolean onHead){ public void playListLoader(AudioPlaylist playlist,int playlistLimit, boolean onHead){
int i = 0; int i = 0;
List<AudioTrack> tracks = playlist.getTracks();
if(onHead)
Collections.reverse(tracks);
for(AudioTrack track : playlist.getTracks()){ for(AudioTrack track : playlist.getTracks()){
play(guild, playedChanel, musicManager, track, onHead); play(guild, playedChanel, musicManager, track, onHead);
i++; i++;

View File

@ -10,10 +10,9 @@ $(document).ready(function() {
$('#modalAdd').modal(); $('#modalAdd').modal();
$('#modalChanels').modal({ $('#modalChanels').modal({
dismissible: false, // Modal can be dismissed by clicking outside of the modal dismissible: false // Modal can be dismissed by clicking outside of the modal
}) });
$('#modalChanels').modal('open');
$('.button-collapse-1').sideNav({ $('.button-collapse-1').sideNav({
@ -22,7 +21,6 @@ $(document).ready(function() {
closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor
draggable: true // Choose whether you can drag to open on touch screens, draggable: true // Choose whether you can drag to open on touch screens,
}); });
var height = $( window ).height();
$('#btn_play').click(function () { $('#btn_play').click(function () {
switch (state){ switch (state){
@ -35,14 +33,14 @@ $(document).ready(function() {
break; break;
} }
}) });
$('#btn_next').click(function () { $('#btn_next').click(function () {
sendCommand(JSON.stringify({ command: "NEXT"})); sendCommand(JSON.stringify({ command: "NEXT"}));
}) });
$('#btn_stop').click(function () { $('#btn_stop').click(function () {
sendCommand(JSON.stringify({ command: "STOP"})); sendCommand(JSON.stringify({ command: "STOP"}));
}) });
$('.dropdown-button').dropdown({ $('.dropdown-button').dropdown({
inDuration: 300, inDuration: 300,
@ -74,6 +72,7 @@ $(document).ready(function() {
} }
} }
}); });
$('#modalChanels').change(function () { $('#modalChanels').change(function () {
if ($('#btn_ok_channel').hasClass("disabled")) { if ($('#btn_ok_channel').hasClass("disabled")) {
$('#btn_ok_channel').removeClass("disabled"); $('#btn_ok_channel').removeClass("disabled");