diff --git a/libs/childNode.js b/libs/childNode.js index 2489974d..5df2a87d 100644 --- a/libs/childNode.js +++ b/libs/childNode.js @@ -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; diff --git a/libs/monitor.js b/libs/monitor.js index e4864970..4b1dc849 100644 --- a/libs/monitor.js +++ b/libs/monitor.js @@ -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)} } } diff --git a/libs/videos.js b/libs/videos.js index 41cd397c..932886e0 100644 --- a/libs/videos.js +++ b/libs/videos.js @@ -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){ - - }) - }) } } } diff --git a/web/libs/js/main.dash2.js b/web/libs/js/main.dash2.js index d164dec2..968ecb00 100644 --- a/web/libs/js/main.dash2.js +++ b/web/libs/js/main.dash2.js @@ -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={};