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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -13,11 +13,13 @@ var List = {
switch(msg.type)
{
case "list":
List.populate_list(msg.playlist);
if(chromecastAvailable){
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
if(full_playlist == undefined || !offline){
List.populate_list(msg.playlist);
if(chromecastAvailable){
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
}
break;
}
break;
case "added":
List.added_song(msg.value);
if(chromecastAvailable){
@@ -279,28 +281,29 @@ var List = {
added_song: function(added){
var now_playing;
if(full_playlist.length !== 0){
now_playing = full_playlist.pop();
}
full_playlist.push(added);
List.sortList();
if(now_playing){
full_playlist.push(now_playing);
}
$("#suggested-"+added.id).remove();
if(List.empty){
List.empty = false;
}
$("#empty-channel-message").remove();
List.insertAtIndex(added, true);
if($("#wrapper").children().length > List.page + List.can_fit){
$(".next_page_hide").css("display", "none");
$(".next_page").removeClass("hide");
$(".next_page").css("display", "inline-block");
} else {
$(".next_page_hide").css("display", "inline-block");
$(".next_page").css("display", "none");
if(added != undefined){
if(full_playlist.length !== 0){
now_playing = full_playlist.pop();
}
full_playlist.push(added);
List.sortList();
if(now_playing){
full_playlist.push(now_playing);
}
$("#suggested-"+added.id).remove();
if(List.empty){
List.empty = false;
}
$("#empty-channel-message").remove();
List.insertAtIndex(added, true);
if($("#wrapper").children().length > List.page + List.can_fit){
$(".next_page_hide").css("display", "none");
$(".next_page").removeClass("hide");
$(".next_page").css("display", "inline-block");
} else {
$(".next_page_hide").css("display", "inline-block");
$(".next_page").css("display", "none");
}
}
},