Merge pull request #190 from zoff-music/fix/cleared_channel

Fixed issue with added a playlist to a recently cleared channel
This commit is contained in:
Kasper Rynning-Tønnesen
2017-10-30 12:26:44 +01:00
committed by GitHub
3 changed files with 14 additions and 4 deletions

View File

@@ -21,8 +21,8 @@ function add_function(arr, coll, guid, offline, socket) {
var last = arr.num == arr.total - 1; var last = arr.num == arr.total - 1;
var num = arr.num; var num = arr.num;
var total = arr.total; var total = arr.total;
db.collection(coll).find({views:{$exists:true}}, function(err, docs) /*db.collection(coll).find({views:{$exists:true}}, function(err, docs)
{ {*/
conf = docs; conf = docs;
if(docs !== null && docs.length !== 0 && ((docs[0].addsongs === true && (hash == docs[0].adminpass || docs[0].adminpass === "")) || if(docs !== null && docs.length !== 0 && ((docs[0].addsongs === true && (hash == docs[0].adminpass || docs[0].adminpass === "")) ||
docs[0].addsongs === false)) docs[0].addsongs === false))
@@ -135,7 +135,7 @@ function add_function(arr, coll, guid, offline, socket) {
socket.emit("toast", "listhaspass"); socket.emit("toast", "listhaspass");
} }
} }
}); //});
} else { } else {
socket.emit("auth_required"); socket.emit("auth_required");
} }

View File

@@ -12,6 +12,7 @@ var conf = [];
var private_channel = false; var private_channel = false;
var music = 0; var music = 0;
var frontpage = 1; var frontpage = 1;
var empty_clear = false;
var adminpass = ""; var adminpass = "";
var showDiscovery = false; var showDiscovery = false;
var temp_name = ""; var temp_name = "";

View File

@@ -153,6 +153,13 @@ var Player = {
} }
duration = Player.player.getDuration(); duration = Player.player.getDuration();
} }
if(Object.keys(obj).length == 0) {
paused = false;
empty_clear = true;
} else {
empty_clear = false;
}
}, },
onPlayerStateChange: function(newState) { onPlayerStateChange: function(newState) {
@@ -208,7 +215,9 @@ var Player = {
$("#playpause").css("pointer-events", "all"); $("#playpause").css("pointer-events", "all");
$("#channel-load").css("display", "none"); $("#channel-load").css("display", "none");
} }
paused = true; if(!empty_clear) {
paused = true;
}
if(window.location.pathname != "/") Playercontrols.play_pause_show(); if(window.location.pathname != "/") Playercontrols.play_pause_show();
mobile_beginning = true; mobile_beginning = true;
} }