diff --git a/lib/channel.js b/lib/channel.js index 1f3da550..ea3dbe1d 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -1343,6 +1343,11 @@ Channel.prototype.tryQueue = function(user, data) { data.temp = !this.hasPermission(user, "addnontemp"); if (data.list) { + if (data.pos === "next") { + data.list.reverse(); + if (this.playlist.items.length === 0) + data.list.unshift(data.list.pop()); + } for (var i = 0; i < data.list.length; i++) { data.list[i].pos = data.pos; this.tryQueue(user, data.list[i]); diff --git a/www/assets/js/ui.js b/www/assets/js/ui.js index 997d5eb9..14b977fb 100644 --- a/www/assets/js/ui.js +++ b/www/assets/js/ui.js @@ -323,9 +323,6 @@ function queue(pos) { return; } var links = $("#mediaurl").val().split(","); - if(pos == "next") { - links = links.reverse(); - } var parsed = []; links.forEach(function(link) { var data = parseMediaLink(link);