childNode database row save fix

+light cleanup
merge-requests/35/head
Moe 2018-10-18 13:41:20 -07:00
parent 53fec70766
commit 5a3309a787
4 changed files with 44 additions and 26 deletions

View File

@ -84,16 +84,29 @@ module.exports = function(s,config,lang,app,io){
ke:d.ke,
mid:d.mid
});
var filesizeMB = parseFloat((d.filesize/1000000).toFixed(2))
s.txWithSubPermissions({
f:'video_build_success',
hrefNoAuth:'/videos/'+d.ke+'/'+d.mid+'/'+d.filename,
filename:d.filename,
mid:d.mid,
ke:d.ke,
time:d.startTime,
time:d.time,
size:d.filesize,
end:d.endTime
},'GRP_'+d.ke,'video_view');
end:d.end
},'GRP_'+d.ke,'video_view')
//purge over max
s.purgeDiskForGroup(d)
//send new diskUsage values
s.setDiskUsedForGroup(d,filesizeMB)
//save database row
s.insertDatabaseRow(d.d,{
startTime : d.time,
filesize : d.filesize,
endTime : d.end,
dir : s.getVideoDirectory(d.d),
file : d.filename
})
clearTimeout(s.group[d.ke].mon[d.mid].recordingChecker)
clearTimeout(s.group[d.ke].mon[d.mid].streamChecker)
break;

View File

@ -1316,6 +1316,6 @@ module.exports = function(s,config,lang){
console.log(x)
break;
}
if(typeof cn==='function'){setTimeout(function(){cn()},1000);}
if(typeof cn === 'function'){setTimeout(function(){cn()},1000)}
}
}

View File

@ -61,6 +61,31 @@ module.exports = function(s,config,lang){
s.insertCompletedVideoExtender = function(callback){
s.insertCompletedVideoExtensions.push(callback)
}
s.insertDatabaseRow = function(e,k,callback){
s.checkDetails(e)
//save database row
k.details = {}
if(e.details&&e.details.dir&&e.details.dir!==''){
k.details.dir = e.details.dir
}
if(config.useUTC === true)k.details.isUTC = config.useUTC;
var save = [
e.mid,
e.ke,
k.startTime,
e.ext,
1,
s.s(k.details),
k.filesize,
k.endTime,
]
s.sqlQuery('INSERT INTO Videos (mid,ke,time,ext,status,details,size,end) VALUES (?,?,?,?,?,?,?,?)',save,function(err){
if(callback)callback(err)
fs.chmod(k.dir+k.file,0o777,function(err){
})
})
}
//on video completion
s.insertCompletedVideo = function(e,k,callback){
//e = monitor object
@ -150,31 +175,11 @@ module.exports = function(s,config,lang){
s.purgeDiskForGroup(e)
//send new diskUsage values
s.setDiskUsedForGroup(e,k.filesizeMB)
s.insertDatabaseRow(e,k,callback)
}
s.insertCompletedVideoExtensions.forEach(function(extender){
extender(e,k)
})
k.details = {}
if(e.details&&e.details.dir&&e.details.dir!==''){
k.details.dir = e.details.dir
}
if(config.useUTC === true)k.details.isUTC = config.useUTC;
var save = [
e.mid,
e.ke,
k.startTime,
e.ext,
1,
s.s(k.details),
k.filesize,
k.endTime,
]
s.sqlQuery('INSERT INTO Videos (mid,ke,time,ext,status,details,size,end) VALUES (?,?,?,?,?,?,?,?)',save,function(err){
if(callback)callback(err)
fs.chmod(k.dir+k.file,0o777,function(err){
})
})
}
}
}

View File

@ -4212,7 +4212,7 @@ $.apM.e.on('click','.delete',function(e){
$.post($.ccio.init('location',$user)+$user.auth_token+'/api/'+$user.ke+'/delete',{data:JSON.stringify({code:e.code})},function(d){
$.ccio.log(d)
})
});
})
})
//filters window
if(!$user.details.filters)$user.details.filters={};