Opening for fetching title only, and adding songs to list without being in them

This commit is contained in:
Kasper Rynning-Tønnesen
2015-05-28 13:41:20 +02:00
parent 04ae12acf9
commit 4c11003152

View File

@@ -25,8 +25,6 @@ io.on('connection', function(socket){
var guid = hash_pass(socket.handshake.headers["user-agent"] + socket.handshake.address + socket.handshake.headers["accept-language"]).substring(0,8); var guid = hash_pass(socket.handshake.headers["user-agent"] + socket.handshake.address + socket.handshake.headers["accept-language"]).substring(0,8);
console.log(guid);
socket.on('ping', function() { socket.on('ping', function() {
socket.emit("ok"); socket.emit("ok");
}); });
@@ -103,6 +101,15 @@ io.on('connection', function(socket){
} }
}); });
socket.on('now_playing', function(list)
{
db.collection(list).find({now_playing:true}, function(err, docs)
{
var title = docs[0]["title"];
socket.emit("title", title);
});
});
socket.on('list', function(list) socket.on('list', function(list)
{ {
if(list !== undefined && list !== null && list != "") if(list !== undefined && list !== null && list != "")
@@ -209,7 +216,8 @@ io.on('connection', function(socket){
{ {
if(arr !== undefined && arr !== null && arr != "") if(arr !== undefined && arr !== null && arr != "")
{ {
check_inlist(coll, guid, socket, name); if(arr.length == 5) coll = arr[4];
else check_inlist(coll, guid, socket, name);
var id = arr[0]; var id = arr[0];
var title = arr[1]; var title = arr[1];