fixed some id errors

This commit is contained in:
Kasper Rynning-Tønnesen
2015-06-10 17:47:53 +02:00
parent d299eb7bb4
commit f332dd8380
2 changed files with 17 additions and 3 deletions

View File

@@ -210,7 +210,8 @@ io.on('connection', function(socket){
added:get_time()}}, function(err, docs){
db.collection(coll).update({views:{$exists:true}},
{$set:{startTime:get_time(), skips:[]}}, function(err, docs){
send_list(coll, undefined, true, true);
io.sockets.emit(coll, ["song_change", get_time()]);
send_play(coll);
});
});
}
@@ -602,7 +603,8 @@ function change_song_post(coll)
added:get_time()}}, function(err, docs){
db.collection(coll).update({views:{$exists:true}},
{$set:{startTime:get_time(), skips:[]}}, function(err, docs){
send_list(coll,undefined,true, true);
io.sockets.emit(coll, ["song_change", get_time()]);
send_play(coll);
});
});

View File

@@ -37,6 +37,7 @@ socket.on(chan.toLowerCase(), function(msg){
setTimeout(function()
{
$("#"+msg[1]).remove();
full_playlist.splice(getIndexOfSong(msg[1]), 1);
}, 1050);
}else if(msg[0] == "vote")
{
@@ -45,6 +46,17 @@ socket.on(chan.toLowerCase(), function(msg){
full_playlist[index_of_song].added = msg[2];
full_playlist.sort(sortFunction);
populate_list(full_playlist, false);
}else if(msg[0] == "song_change")
{
full_playlist[0].now_playing = true;
full_playlist[0].votes = 0;
full_playlist[0].guids = [];
full_playlist[0].added = msg[1];
full_playlist[full_playlist.length-1].now_playing = false;
full_playlist.sort(sortFunction);
populate_list(full_playlist);
}
});
@@ -204,7 +216,7 @@ function insertAtIndex(i, song_info) {
song.find(".list-votes").text(video_votes);
song.find(".vote-container").attr("onclick", "vote('"+video_id+"','pos')");
song.find(".list-image").attr("style",video_thumb);
song.attr("id",video_id);
song.find("#list-song").attr("id", video_id);
song.find("#del").attr("onclick", "vote('"+video_id+"', 'del')");
if(!w_p) song.find(".card-action").removeClass("hide");
if(video_votes == 1)song.find(".vote-text").text("vote");