This commit is contained in:
Kasper Rynning-Tønnesen
2015-04-16 12:53:31 +02:00
parent 6d06553e81
commit 5056b64dd2

View File

@@ -105,7 +105,7 @@ io.on('connection', function(socket){
{ {
db.collection(coll).find({now_playing:true}, function(err, docs){ db.collection(coll).find({now_playing:true}, function(err, docs){
if(docs.length > 0 && docs[0]["id"] == arg){ if(docs.length > 0 && docs[0]["id"] == arg){
change_song(coll, arg); change_song(coll, arg, docs[0]["id"]);
} }
}) })
}); });
@@ -324,7 +324,7 @@ function vote(coll, id, guid, socket)
} }
function change_song(coll, id) function change_song(coll, id, np_id)
{ {
db.collection(coll).find({views:{$exists:true}}, function(err, docs){ db.collection(coll).find({views:{$exists:true}}, function(err, docs){
if(docs[0]["removeplay"] == true) if(docs[0]["removeplay"] == true)
@@ -349,6 +349,8 @@ function change_song(coll, id)
change_song_post(coll); change_song_post(coll);
}); });
}else{ }else{
console.log(id);
console.log(np_id);
db.collection(coll).update({now_playing:true, id:id}, db.collection(coll).update({now_playing:true, id:id},
{$set:{ {$set:{
now_playing:false, now_playing:false,