light updates
- adjust static-ffmpeg check - make inital monitor load synchronousmerge-requests/34/head
parent
8985e20184
commit
00c6a2c025
|
@ -635,7 +635,7 @@
|
|||
"startUpText1": "Completed Checking Disk Used.",
|
||||
"startUpText2": "all users checked, wait to close open files and remove files over user limit",
|
||||
"startUpText3": "waiting to give unfinished video check some time. 3 seconds.",
|
||||
"startUpText4": "Starting Monitors",
|
||||
"startUpText4": "Starting Monitors... Please Wait...",
|
||||
"startUpText5": "Shinobi is ready.",
|
||||
"startUpText6": "Orphaned Videos Found and Inserted",
|
||||
"Migrator": "Migrator",
|
||||
|
|
|
@ -31,15 +31,16 @@ module.exports = function(s,config,onFinish){
|
|||
var ffmpegStaticCheck = function(failback){
|
||||
try{
|
||||
var staticFFmpeg = require('ffmpeg-static').path;
|
||||
if (!fs.existsSync(staticFFmpeg)) {
|
||||
if (fs.statSync(staticFFmpeg)) {
|
||||
config.ffmpegDir = staticFFmpeg
|
||||
}else{
|
||||
console.log('"ffmpeg-static" from NPM has failed to provide a compatible library or has been corrupted.')
|
||||
console.log('Run "npm uninstall ffmpeg-static" to remove it.')
|
||||
console.log('Run "npm install ffbinaries" to get a different static FFmpeg downloader.')
|
||||
}else{
|
||||
config.ffmpegDir = staticFFmpeg
|
||||
}
|
||||
}catch(err){
|
||||
console.log('No "ffmpeg-static".')
|
||||
failback()
|
||||
}
|
||||
}
|
||||
//check node module : ffbinaries
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
var fs = require('fs');
|
||||
var moment = require('moment');
|
||||
var crypto = require('crypto');
|
||||
|
@ -17,18 +18,31 @@ module.exports = function(s,config,lang,io){
|
|||
s.sqlQuery('SELECT * FROM Monitors', function(err,monitors) {
|
||||
if(err){s.systemLog(err)}
|
||||
if(monitors && monitors[0]){
|
||||
monitors.forEach(function(monitor){
|
||||
var loadCompleted = 0
|
||||
var orphanedVideosForMonitors = {}
|
||||
var loadMonitor = function(monitor){
|
||||
if(!orphanedVideosForMonitors[monitor.ke])orphanedVideosForMonitors[monitor.ke] = {}
|
||||
if(!orphanedVideosForMonitors[monitor.ke][monitor.mid])orphanedVideosForMonitors[monitor.ke][monitor.mid] = 0
|
||||
s.initiateMonitorObject(monitor)
|
||||
s.orphanedVideoCheck(monitor,null,function(orphanedFilesCount){
|
||||
if(orphanedFilesCount)s.systemLog(monitor.ke+' : '+monitor.mid+' : '+lang.startUpText6+' : '+orphanedFilesCount)
|
||||
if(orphanedFilesCount){
|
||||
orphanedVideosForMonitors[monitor.ke][monitor.mid] += orphanedFilesCount
|
||||
}
|
||||
monitor.details = monitor.details
|
||||
s.group[monitor.ke].mon_conf[monitor.mid] = monitor
|
||||
var monObj = Object.assign(monitor,{id : monitor.mid})
|
||||
s.camera(monitor.mode,monObj)
|
||||
++loadCompleted
|
||||
if(monitors[loadCompleted]){
|
||||
loadMonitor(monitors[loadCompleted])
|
||||
}else{
|
||||
s.systemLog(lang.startUpText6+' : '+s.s(orphanedVideosForMonitors))
|
||||
callback()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
loadMonitor(monitors[loadCompleted])
|
||||
}
|
||||
callback()
|
||||
})
|
||||
}
|
||||
var loadDiskUseForUser = function(user,callback){
|
||||
|
|
Loading…
Reference in New Issue