Maybe fix for skip issue

This commit is contained in:
Kasper Rynning-Tønnesen
2015-04-18 13:30:26 +02:00
parent 73e64de1ff
commit e904264f68

View File

@@ -401,34 +401,16 @@ function change_song(coll, id, np_id)
}) })
}else }else
{ {
if(id === undefined){
//console.log("undef"); //console.log("undef");
db.collection(coll).update({now_playing:true}, db.collection(coll).update({now_playing:true},
{$set:{ {$set:{
now_playing:false, now_playing:false,
votes:0, votes:0,
guids:[] guids:[]
}}, function(err, docs) },{multi:true}}, function(err, docs)
{ {
change_song_post(coll); change_song_post(coll);
}); });
}else{
db.collection(coll).find({id:id}, function(err, docs){
if(startTime+docs[0]["duration"]<=get_time()-1)
{
db.collection(coll).update({now_playing:true, id:id},
{$set:{
now_playing:false,
votes:0,
guids:[]
}}, function(err, docs)
{
change_song_post(coll);
});
}
});
}
}
}) })
} }