1
0
Fork 0
mirror of https://gitlab.com/Shinobi-Systems/ShinobiCE.git synced 2025-03-09 15:40:15 +00:00

Blue Turtle - Minor Additions and Bug Fixes

This commit is contained in:
Moe 2018-10-29 09:02:55 -07:00
parent c7e70c03e8
commit bc01b19714
6 changed files with 84 additions and 15 deletions

View file

@ -328,9 +328,15 @@ module.exports = function(s,config,lang){
}else{
detector_timeout = parseFloat(currentConfig.detector_timeout)
}
if(currentConfig.watchdog_reset !== '1' || !s.group[d.ke].mon[d.id].eventBasedRecording.timeout){
clearTimeout(s.group[d.ke].mon[d.id].eventBasedRecording.timeout)
s.group[d.ke].mon[d.id].eventBasedRecording.timeout = setTimeout(function(){
s.group[d.ke].mon[d.id].eventBasedRecording.allowEnd=true;
},detector_timeout * 950 * 60)
s.group[d.ke].mon[d.id].eventBasedRecording.allowEnd = true
s.group[d.ke].mon[d.id].eventBasedRecording.process.stdin.setEncoding('utf8')
s.group[d.ke].mon[d.id].eventBasedRecording.process.stdin.write('q')
delete(s.group[d.ke].mon[d.id].eventBasedRecording.timeout)
},detector_timeout * 1000 * 60)
}
if(!s.group[d.ke].mon[d.id].eventBasedRecording.process){
if(!d.auth){
d.auth = s.gid(60)
@ -348,7 +354,7 @@ module.exports = function(s,config,lang){
var filename = s.formattedTime()+'.mp4'
s.userLog(d,{type:"Traditional Recording",msg:"Started"})
//-t 00:'+s.timeObject(new Date(detector_timeout * 1000 * 60)).format('mm:ss')+'
s.group[d.ke].mon[d.id].eventBasedRecording.process = spawn(config.ffmpegDir,s.splitForFFPMEG(('-loglevel warning -analyzeduration 1000000 -probesize 1000000 -re -i http://'+config.ip+':'+config.port+'/'+d.auth+'/hls/'+d.ke+'/'+d.id+'/detectorStream.m3u8 -t 00:'+s.timeObject(new Date(detector_timeout * 1000 * 60)).format('mm:ss')+' -c:v copy -strftime 1 "'+s.getVideoDirectory(d.mon) + filename + '"')))
s.group[d.ke].mon[d.id].eventBasedRecording.process = spawn(config.ffmpegDir,s.splitForFFPMEG(('-loglevel warning -analyzeduration 1000000 -probesize 1000000 -re -i http://'+config.ip+':'+config.port+'/'+d.auth+'/hls/'+d.ke+'/'+d.id+'/detectorStream.m3u8 -c:v copy -strftime 1 "'+s.getVideoDirectory(d.mon) + filename + '"')))
var ffmpegError='';
var error
s.group[d.ke].mon[d.id].eventBasedRecording.process.stderr.on('data',function(data){

View file

@ -198,7 +198,8 @@ module.exports = function(s,config,onFinish){
//`e` is the monitor object
//`x` is an object used to contain temporary values.
var x = {
pipe:''
pipe: '',
cust_stream: ''
}
if(!number||number==''){
x.channel_sdir = e.sdir;
@ -245,7 +246,7 @@ module.exports = function(s,config,onFinish){
//hls list size
if(channel.hls_list_size&&channel.hls_list_size!==''){x.hls_list_size=channel.hls_list_size}else{x.hls_list_size=2}
//stream - custom flags
if(channel.cust_stream&&channel.cust_stream!==''){x.cust_stream=' '+channel.cust_stream}else{x.cust_stream=''}
if(channel.cust_stream&&channel.cust_stream!==''){x.cust_stream=' '+channel.cust_stream}
//stream - preset
if(channel.stream_type !== 'h265' && channel.preset_stream && channel.preset_stream!==''){x.preset_stream=' -preset '+channel.preset_stream;}else{x.preset_stream=''}
//hardware acceleration
@ -441,6 +442,7 @@ module.exports = function(s,config,onFinish){
//x = temporary values
x.stream_video_filters = []
x.pipe = ''
x.cust_stream = ''
//stream - timestamp
if(e.details.stream_timestamp&&e.details.stream_timestamp=="1"&&e.details.vcodec!=='copy'){
//font
@ -496,7 +498,7 @@ module.exports = function(s,config,onFinish){
if(e.details.hls_time&&e.details.hls_time!==''){x.hls_time=e.details.hls_time}else{x.hls_time="2"} //hls list size
if(e.details.hls_list_size&&e.details.hls_list_size!==''){x.hls_list_size=e.details.hls_list_size}else{x.hls_list_size=2}
//stream - custom flags
if(e.details.cust_stream&&e.details.cust_stream!==''){x.cust_stream=' '+e.details.cust_stream}else{x.cust_stream=''}
if(e.details.cust_stream&&e.details.cust_stream!==''){x.cust_stream=' '+e.details.cust_stream}
//stream - preset
if(e.details.stream_type !== 'h265' && e.details.preset_stream && e.details.preset_stream !== ''){x.preset_stream=' -preset '+e.details.preset_stream;}else{x.preset_stream=''}
@ -524,9 +526,12 @@ module.exports = function(s,config,onFinish){
//add input feed map
x.pipe += s.createFFmpegMap(e,e.details.input_map_choices.stream)
}
if(e.details.stream_vcodec !== 'copy' || e.details.stream_type === 'mjpeg' || e.details.stream_type === 'b64'){
console.log('x.cust_stream',x.cust_stream)
if(x.stream_fps && (e.details.stream_vcodec !== 'copy' || e.details.stream_type === 'mjpeg' || e.details.stream_type === 'b64')){
x.cust_stream += x.stream_fps
}
console.log('x.cust_stream',x.cust_stream)
switch(e.details.stream_type){
case'mp4':
x.cust_stream+=' -movflags +frag_keyframe+empty_moov+default_base_moof -metadata title="Poseidon Stream" -reset_timestamps 1'
@ -660,7 +665,7 @@ module.exports = function(s,config,onFinish){
//record - frames per second (fps)
if(e.fps&&e.fps!==''&&e.details.vcodec!=='copy'){x.record_fps=' -r '+e.fps}else{x.record_fps=''}
//stream - frames per second (fps)
if(e.details.stream_fps&&e.details.stream_fps!==''){x.stream_fps=' -r '+e.details.stream_fps}else{x.stream_fps=''}
if(e.details.stream_fps&&e.details.stream_fps!==''){x.stream_fps=' -r '+e.details.stream_fps}else{x.stream_fps = ''}
//record - timestamp options for -vf
if(e.details.timestamp&&e.details.timestamp=="1"&&e.details.vcodec!=='copy'){
//font

View file

@ -1004,7 +1004,11 @@ module.exports = function(s,config,lang){
s.group[e.ke].mon[e.id].fswatch = fs.watch(e.dir, {encoding : 'utf8'}, (event, filename) => {
switch(event){
case'rename':
try{
s.group[e.ke].mon[e.id].open = filename.split('.')[0]
}catch(err){
s.debugLog('Failed to split filename : ',filename)
}
break;
case'change':
s.resetRecordingCheck(e)

View file

@ -377,11 +377,15 @@ module.exports = function(s,config,lang,app){
}
if(r.details.sub){
s.sqlQuery('SELECT details FROM Users WHERE ke=? AND details NOT LIKE ?',[r.ke,'%"sub"%'],function(err,rr) {
if(rr && rr[0]){
rr=rr[0];
rr.details=JSON.parse(rr.details);
r.details.mon_groups=rr.details.mon_groups;
req.resp.details=JSON.stringify(r.details);
req.factorAuth()
}else{
failedAuthentication(req.body.function)
}
})
}else{
req.factorAuth()

View file

@ -408,4 +408,54 @@ module.exports = function(s,config,lang,app){
close()
},res,req)
})
/**
* API : Superuser : Export Entire System
*/
app.all(config.webPaths.superApiPrefix+':auth/export/system', function (req,res){
s.superAuth(req.params,function(resp){
var endData = {
ok : true
}
var close = function(){
res.end(s.prettyPrint(endData))
}
var account = s.getPostData(req,'account')
s.sqlQuery('SELECT FROM Users',[],function(err,users){
s.sqlQuery('SELECT FROM Monitors',[],function(err,monitors){
s.sqlQuery('SELECT FROM API',[],function(err,monitors){
s.sqlQuery('SELECT FROM Videos',[],function(err,monitors){
s.sqlQuery('SELECT FROM Logs',[],function(err,monitors){
})
})
})
})
})
s.sqlQuery('DELETE FROM API WHERE uid=? AND ke=?',[account.uid,account.ke])
if(s.getPostData(req,'deleteSubAccounts',false) === '1'){
s.sqlQuery('DELETE FROM Users WHERE ke=?',[account.ke])
}
if(s.getPostData(req,'deleteMonitors',false) == '1'){
s.sqlQuery('SELECT * FROM Monitors WHERE ke=?',[account.ke],function(err,monitors){
if(monitors && monitors[0]){
monitors.forEach(function(monitor){
s.camera('stop',monitor)
})
s.sqlQuery('DELETE FROM Monitors WHERE ke=?',[account.ke])
}
})
}
if(s.getPostData(req,'deleteVideos',false) == '1'){
s.sqlQuery('DELETE FROM Videos WHERE ke=?',[account.ke])
fs.chmod(s.dir.videos+account.ke,0o777,function(err){
fs.unlink(s.dir.videos+account.ke,function(err){})
})
}
if(s.getPostData(req,'deleteEvents',false) == '1'){
s.sqlQuery('DELETE FROM Events WHERE ke=?',[account.ke])
}
s.tx({f:'delete_account',ke:account.ke,uid:account.uid,mail:account.mail},'$')
close()
},res,req)
})
}

View file

@ -938,7 +938,7 @@
</label>
</div>
</div>
<div class="form-group h_rec_mtd_input h_rec_mtd_hot">
<div class="form-group h_rec_mtd_input h_rec_mtd_hot h_rec_mtd_sip">
<label><div><span><%-lang['Timeout Reset on Next Event']%></span></div>
<div><select class="form-control" detail="watchdog_reset">
<option value="0"><%-lang.No%></option>