light function cleanup

merge-requests/30/head
Moe 2018-09-29 13:09:47 -07:00
parent 19a24f5f38
commit d5cabef179
3 changed files with 11 additions and 11 deletions

View File

@ -161,7 +161,7 @@ io = require('socket.io-client')('ws://'+config.ip+':'+config.port);//connect to
s.cx=function(x){x.cronKey=config.cron.key;return io.emit('cron',x)}
//emulate master socket emitter
s.tx=function(x,y){s.cx({f:'s.tx',data:x,to:y})}
s.video=function(x,y){s.cx({f:'s.video',data:x,file:y})}
s.deleteVideo=function(x){s.cx({f:'s.deleteVideo',file:x})}
//Cron Job
s.cx({f:'init',time:moment()})
s.getVideoDirectory=function(e){
@ -321,7 +321,7 @@ s.deleteRowsWithNoVideo=function(v,callback){
}
fileExists = fs.existsSync(dir+filename)
if(fileExists !== true){
s.video('delete',ev)
s.deleteVideo(ev)
s.tx({f:'video_delete',filename:filename+'.'+ev.ext,mid:ev.mid,ke:ev.ke,time:ev.time,end:s.moment(new Date,'YYYY-MM-DD HH:mm:ss')},'GRP_'+ev.ke);
}
});

View File

@ -1316,8 +1316,8 @@ module.exports = function(s,config,io){
case's.tx':
s.tx(d.data,d.to)
break;
case's.video':
s.video(d.data,d.file)
case's.deleteVideo':
s.deleteVideo(d.file)
break;
case'start':case'end':
d.mid='_cron';s.log(d,{type:'cron',msg:d.msg})

View File

@ -32,17 +32,17 @@ module.exports = function(s,config,lang,io){
setTimeout(function(){
//get current disk used for each isolated account (admin user) on startup
s.sqlQuery('SELECT * FROM Users WHERE details NOT LIKE ?',['%"sub"%'],function(err,r){
if(r&&r[0]){
if(r && r[0]){
var count = r.length
var countFinished = 0
r.forEach(function(v,n){
v.size=0;
v.limit=JSON.parse(v.details).size
v.size = 0
v.limit = JSON.parse(v.details).size
s.sqlQuery('SELECT * FROM Videos WHERE ke=? AND status!=?',[v.ke,0],function(err,rr){
++countFinished
if(r&&r[0]){
rr.forEach(function(b){
v.size+=b.size
v.size += b.size
})
}
s.systemLog(v.mail+' : '+lang.startUpText0+' : '+rr.length,v.size)
@ -57,10 +57,10 @@ module.exports = function(s,config,lang,io){
if(r&&r[0]){
r.forEach(function(v){
s.initiateMonitorObject(v);
r.ar={};
r.ar.id = v.mid;
r.ar = {}
r.ar.id = v.mid
Object.keys(v).forEach(function(b){
r.ar[b]=v[b];
r.ar[b] = v[b]
})
v.details=JSON.parse(v.details)
s.group[v.ke].mon_conf[v.mid] = v