From d5993038815bad6bf348c7a74d5320fd33870956 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Tue, 6 Aug 2013 20:41:29 -0400 Subject: [PATCH] Fix #244, Fix #247, Change 'Show Library' to 'Show Library/YouTube Search' --- channel.js | 4 +++- playlist.js | 33 +++++++++++++-------------------- www/channel.html | 2 +- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/channel.js b/channel.js index 5558ca75..67b57812 100644 --- a/channel.js +++ b/channel.js @@ -1274,7 +1274,6 @@ Channel.prototype.addMedia = function(data, user) { } Channel.prototype.addMediaList = function(data, user) { - var pl = data.list; var chan = this; this.playlist.addMediaList(data, function(err, item) { if(err) { @@ -1285,6 +1284,8 @@ Channel.prototype.addMediaList = function(data, user) { return; } else { + item.temp = data.temp; + item.queueby = data.queueby; chan.sendAll("queue", { item: item.pack(), after: item.prev ? item.prev.uid : "prepend" @@ -1312,6 +1313,7 @@ Channel.prototype.tryQueuePlaylist = function(user, data) { var pl = this.server.db.loadUserPlaylist(user.name, data.name); data.list = pl; data.queueby = user.name; + data.temp = !this.hasPermission(user, "addnontemp"); this.addMediaList(data, user); } diff --git a/playlist.js b/playlist.js index f6f412f9..c156045c 100644 --- a/playlist.js +++ b/playlist.js @@ -285,29 +285,22 @@ Playlist.prototype.addMediaList = function(data, callback) { var pl = this; for(var i = 0; i < data.list.length; i++) { var x = data.list[i]; - (function(i, x) { - setTimeout(function() { - if(pl.dead) - return; - x.queueby = data.queueby; - x.pos = data.pos; - if(start && x == start) { - pl.addMedia(x, function (err, item) { - if(err) { - callback(err, item); - } - else { - callback(err, item); - pl.current = item; - pl.startPlayback(); - } - }); + x.pos = data.pos; + if(start && x == start) { + pl.addMedia(x, function (err, item) { + if(err) { + callback(err, item); } else { - pl.addMedia(x, callback); + callback(err, item); + pl.current = item; + pl.startPlayback(); } - }, 500 * i); - })(i, x); + }); + } + else { + pl.addMedia(x, callback); + } } } diff --git a/www/channel.html b/www/channel.html index b13822dd..e6eded22 100644 --- a/www/channel.html +++ b/www/channel.html @@ -106,7 +106,7 @@
-

Show Library

+

Show Library/YouTube Search