This commit is contained in:
Hiro Protagonist 2016-09-09 13:28:43 +12:00
parent 5119791a43
commit 32f79e7eb0

37
main.js
View file

@ -37,8 +37,8 @@ let logger = new(winston.Logger)({
new(winston.transports.Console)({ new(winston.transports.Console)({
level: 'success' level: 'success'
}), }),
new(winston.transports.File)({ new(winston.winston.transports.File)({
filename: __dirname + '/process.log', file: __dirname + '/process.log',
colorize: true, colorize: true,
timestamp: true, timestamp: true,
json: true, json: true,
@ -68,10 +68,10 @@ let spawn = function() {
}) })
.videoCodec('copy'); .videoCodec('copy');
if(config.customOutputOptions !== "") if (config.customOutputOptions !== "")
cmd.outputOptions(config.customOutputOptions.split(',')); cmd.outputOptions(config.customOutputOptions.split(','));
cmd.on('start', function(commandLine) { cmd.on('start', function(commandLine) {
status.running = 0; status.running = 0;
logger.log(importance[4], 'Spawned Ffmpeg with command: ' + commandLine); logger.log(importance[4], 'Spawned Ffmpeg with command: ' + commandLine);
}) })
@ -149,19 +149,22 @@ function imDead(why, e = '') {
} }
function criticalProblem(err, e, handler, ...args) { function criticalProblem(err, e, handler, ...args) {
setTimeout(function() { if (!mustBe) {
status.running = 2 setTimeout(function() {
status.error = err status.running = 2
logger.log(importance[3], 'Critical Problem: ' + errors[err] + '\n' + e); status.error = err
socket.emit('change', { logger.log(importance[3], 'Critical Problem: ' + errors[err] + '\n' + e);
type: 'error', socket.emit('change', {
change: { type: 'error',
running: 2, change: {
error: err running: 2,
} error: err
}); }
handler(args) });
}, 1000); handler(args)
}, 1000);
}
mustBe = false;
} }
function handleDisc(info) { function handleDisc(info) {