refactored and moved a lot of code around to separate files

This commit is contained in:
Kasper Rynning-Tønnesen
2017-09-12 16:50:26 +02:00
parent 657ace250a
commit 977d3846f4
13 changed files with 1712 additions and 1571 deletions

View File

@@ -0,0 +1,22 @@
var frontpage_lists = function(msg, socket) {
if(!msg.hasOwnProperty('version') || msg.version != VERSION || msg.version == undefined) {
socket.emit("update_required");
}
db.collection("frontpage_lists").find({frontpage:true, count: {$gt: 0}}, function(err, docs){
db.collection("connected_users").find({"_id": "total_users"}, function(err, tot){
socket.emit("playlists", {channels: docs, viewers: tot[0].total_users});
});
});
}
function update_frontpage(coll, id, title) {
db.collection("frontpage_lists").update({_id: coll}, {$set: {
id: id,
title: title,
accessed: Functions.get_time()}
},{upsert: true}, function(err, returnDocs){});
}
module.exports.update_frontpage = update_frontpage;
module.exports.frontpage_lists = frontpage_lists;