Fixed issue on serverrestart, stocking over the playlist regardless if the player is in private mode or not

This commit is contained in:
Kasper Rynning-Tønnesen
2017-01-26 14:59:42 +01:00
parent c72c2c9a3a
commit 09c75ed8b6
3 changed files with 32 additions and 29 deletions
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+29 -26
View File
@@ -13,11 +13,13 @@ var List = {
switch(msg.type) switch(msg.type)
{ {
case "list": case "list":
List.populate_list(msg.playlist); if(full_playlist == undefined || !offline){
if(chromecastAvailable){ List.populate_list(msg.playlist);
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); if(chromecastAvailable){
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
}
break;
} }
break;
case "added": case "added":
List.added_song(msg.value); List.added_song(msg.value);
if(chromecastAvailable){ if(chromecastAvailable){
@@ -279,28 +281,29 @@ var List = {
added_song: function(added){ added_song: function(added){
var now_playing; var now_playing;
if(added != undefined){
if(full_playlist.length !== 0){ if(full_playlist.length !== 0){
now_playing = full_playlist.pop(); now_playing = full_playlist.pop();
} }
full_playlist.push(added); full_playlist.push(added);
List.sortList(); List.sortList();
if(now_playing){ if(now_playing){
full_playlist.push(now_playing); full_playlist.push(now_playing);
} }
$("#suggested-"+added.id).remove(); $("#suggested-"+added.id).remove();
if(List.empty){ if(List.empty){
List.empty = false; List.empty = false;
} }
$("#empty-channel-message").remove(); $("#empty-channel-message").remove();
List.insertAtIndex(added, true); List.insertAtIndex(added, true);
if($("#wrapper").children().length > List.page + List.can_fit){ if($("#wrapper").children().length > List.page + List.can_fit){
$(".next_page_hide").css("display", "none"); $(".next_page_hide").css("display", "none");
$(".next_page").removeClass("hide"); $(".next_page").removeClass("hide");
$(".next_page").css("display", "inline-block"); $(".next_page").css("display", "inline-block");
} else { } else {
$(".next_page_hide").css("display", "inline-block"); $(".next_page_hide").css("display", "inline-block");
$(".next_page").css("display", "none"); $(".next_page").css("display", "none");
}
} }
}, },