mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-08 20:48:48 +00:00
Skippedtimes
This commit is contained in:
@@ -81,13 +81,13 @@ var Filter = require('bad-words');
|
|||||||
var filter = new Filter({ placeHolder: 'x'});
|
var filter = new Filter({ placeHolder: 'x'});
|
||||||
|
|
||||||
var port = 8080;
|
var port = 8080;
|
||||||
var lists = {};
|
//var lists = {};
|
||||||
var offline_users = [];
|
//var offline_users = [];
|
||||||
var unique_ids = [];
|
//var unique_ids = [];
|
||||||
var names = {names: []};
|
var names = {names: []};
|
||||||
var locks = {};
|
//var locks = {};
|
||||||
var skipped = {};
|
//var skipped = {};
|
||||||
var tot_view = 0;
|
//var tot_view = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -950,7 +950,7 @@ io.on('connection', function(socket){
|
|||||||
(docs[0].adminpass == hash && docs[0].adminpass !== "" && docs[0].skip))
|
(docs[0].adminpass == hash && docs[0].adminpass !== "" && docs[0].skip))
|
||||||
{
|
{
|
||||||
//if(!locks[coll] || locks[coll] == undefined){
|
//if(!locks[coll] || locks[coll] == undefined){
|
||||||
locks[coll] = true;
|
//locks[coll] = true;
|
||||||
change_song(coll, error, video_id);
|
change_song(coll, error, video_id);
|
||||||
socket.emit("toast", "skip");
|
socket.emit("toast", "skip");
|
||||||
io.to(coll).emit('chat', {from: name, msg: " skipped"});
|
io.to(coll).emit('chat', {from: name, msg: " skipped"});
|
||||||
@@ -1538,8 +1538,10 @@ function change_song(coll, error, id) {
|
|||||||
db.collection("frontpage_lists").update({_id: coll}, {$inc: {count: -1}, $set:{accessed: get_time()}}, {upsert: true}, function(err, docs){});
|
db.collection("frontpage_lists").update({_id: coll}, {$inc: {count: -1}, $set:{accessed: get_time()}}, {upsert: true}, function(err, docs){});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(skipped[coll] != get_time()){
|
if((docs[0].skipped_time != undefined && docs[0].skipped_time != get_time()) || docs[0].skipped_time == undefined) {
|
||||||
skipped[coll] = get_time();
|
//if(skipped[coll] != get_time()){
|
||||||
|
db.collection(coll).update({views: {$exists: true}}, {$set: {skipped_time: get_time()}}, function(err, updated){
|
||||||
|
//skipped[coll] = get_time();
|
||||||
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,
|
||||||
@@ -1551,6 +1553,7 @@ function change_song(coll, error, id) {
|
|||||||
if(now_playing_doc.length == 2) next_song = now_playing_doc[1].id;
|
if(now_playing_doc.length == 2) next_song = now_playing_doc[1].id;
|
||||||
if(docs.n >= 1) change_song_post(coll, next_song);
|
if(docs.n >= 1) change_song_post(coll, next_song);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1564,7 +1567,8 @@ function change_song(coll, error, id) {
|
|||||||
db.collection("frontpage_lists").update({_id: coll}, {$inc: {count: -1}, $set:{accessed: get_time()}}, {upsert: true}, function(err, docs){});
|
db.collection("frontpage_lists").update({_id: coll}, {$inc: {count: -1}, $set:{accessed: get_time()}}, {upsert: true}, function(err, docs){});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(skipped[coll] != get_time()){
|
if((docs[0].skipped_time != undefined && docs[0].skipped_time != get_time()) || docs[0].skipped_time == undefined) {
|
||||||
|
//if(skipped[coll] != get_time()){
|
||||||
//skipped[coll] = get_time();
|
//skipped[coll] = get_time();
|
||||||
db.collection(coll).update({now_playing:true, id:id}, {
|
db.collection(coll).update({now_playing:true, id:id}, {
|
||||||
$set:{
|
$set:{
|
||||||
@@ -1632,7 +1636,7 @@ function change_song_post(coll, next_song)
|
|||||||
db.collection(coll).find({views:{$exists:true}}, function(err, conf){
|
db.collection(coll).find({views:{$exists:true}}, function(err, conf){
|
||||||
io.to(coll).emit("channel", {type: "song_change", time: get_time(), remove: conf[0].removeplay});
|
io.to(coll).emit("channel", {type: "song_change", time: get_time(), remove: conf[0].removeplay});
|
||||||
send_play(coll);
|
send_play(coll);
|
||||||
locks[coll] = false;
|
//locks[coll] = false;
|
||||||
update_frontpage(coll, docs[0].id, docs[0].title);
|
update_frontpage(coll, docs[0].id, docs[0].title);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user