add toggle for Snapshot type in Notifications section

change-spawn-to-worker-for-monitor-daemon
Moe 2021-07-02 19:39:57 -07:00
parent 8ff711daca
commit 4638ee66a0
6 changed files with 37 additions and 28 deletions

View File

@ -4012,6 +4012,23 @@ module.exports = function(s,config,lang){
} }
] ]
}, },
{
"name": "detail=notify_useRawSnapshot",
"field": lang['Use Raw Snapshot'],
"default": "0",
"example": "1",
"fieldType": "select",
"possible": [
{
"name": lang.No,
"value": "0"
},
{
"name": lang.Yes,
"value": "1"
}
]
},
] ]
}, },
"Logging": { "Logging": {

View File

@ -18,6 +18,7 @@
"deleteSubAccountText": "Do you want to delete this Sub-Account? You cannot recover it.", "deleteSubAccountText": "Do you want to delete this Sub-Account? You cannot recover it.",
"Turn Speed": "Turn Speed", "Turn Speed": "Turn Speed",
"Session Key": "Session Key", "Session Key": "Session Key",
"Use Raw Snapshot": "Use Raw Snapshot",
"Login": "Login", "Login": "Login",
"API Key Action Failed": "API Key Action Failed", "API Key Action Failed": "API Key Action Failed",
"Authenticate": "Authenticate", "Authenticate": "Authenticate",

View File

@ -1,6 +1,16 @@
var fs = require("fs") var fs = require("fs")
module.exports = function(s,config,lang){ module.exports = function(s,config,lang){
require('./notifications/email.js')(s,config,lang) async function getSnapshot(d,monitorConfig){
require('./notifications/discordBot.js')(s,config,lang) d.screenshotBuffer = d.screenshotBuffer || d.frame
require('./notifications/telegram.js')(s,config,lang) if(!d.screenshotBuffer || (monitorConfig.details.notify_useRawSnapshot === '1' && !d.usingRawSnapshotBuffer)){
d.usingRawSnapshotBuffer = true
const { screenShot, isStaticFile } = await s.getRawSnapshotFromMonitor(monitorConfig,{
secondsInward: monitorConfig.details.snap_seconds_inward
})
d.screenshotBuffer = screenShot
}
}
require('./notifications/email.js')(s,config,lang,getSnapshot)
require('./notifications/discordBot.js')(s,config,lang,getSnapshot)
require('./notifications/telegram.js')(s,config,lang,getSnapshot)
} }

View File

@ -1,6 +1,6 @@
var fs = require("fs") var fs = require("fs")
var Discord = require("discord.js") var Discord = require("discord.js")
module.exports = function(s,config,lang){ module.exports = function(s,config,lang,getSnapshot){
const { const {
getEventBasedRecordingUponCompletion, getEventBasedRecordingUponCompletion,
} = require('../events/utils.js')(s,config,lang) } = require('../events/utils.js')(s,config,lang)
@ -81,7 +81,6 @@ module.exports = function(s,config,lang){
videoPath = siftedVideoFileFromRam.filePath videoPath = siftedVideoFileFromRam.filePath
videoName = siftedVideoFileFromRam.filename videoName = siftedVideoFileFromRam.filename
} }
console.log(videoPath,videoName)
if(videoPath){ if(videoPath){
sendMessage({ sendMessage({
author: { author: {
@ -103,13 +102,7 @@ module.exports = function(s,config,lang){
],d.ke) ],d.ke)
} }
} }
d.screenshotBuffer = d.screenshotBuffer || d.frame await getSnapshot(d,monitorConfig)
if(!d.screenshotBuffer){
const { screenShot, isStaticFile } = await s.getRawSnapshotFromMonitor(monitorConfig,{
secondsInward: monitorConfig.details.snap_seconds_inward
})
d.screenshotBuffer = screenShot
}
if(d.screenshotBuffer){ if(d.screenshotBuffer){
sendMessage({ sendMessage({
author: { author: {

View File

@ -3,7 +3,7 @@ const {
template, template,
checkEmail, checkEmail,
} = require("./emailUtils.js") } = require("./emailUtils.js")
module.exports = function(s,config,lang){ module.exports = function(s,config,lang,getSnapshot){
const { const {
getEventBasedRecordingUponCompletion, getEventBasedRecordingUponCompletion,
} = require('../events/utils.js')(s,config,lang) } = require('../events/utils.js')(s,config,lang)
@ -193,13 +193,7 @@ module.exports = function(s,config,lang){
}) })
} }
} }
d.screenshotBuffer = d.screenshotBuffer || d.frame await getSnapshot(d,monitorConfig)
if(!d.screenshotBuffer){
const {screenShot, isStaticFile} = await s.getRawSnapshotFromMonitor(monitorConfig,{
secondsInward: monitorConfig.details.snap_seconds_inward
})
if(screenShot)d.screenshotBuffer = screenShot
}
sendMail([ sendMail([
{ {
filename: d.screenshotName + '.jpg', filename: d.screenshotName + '.jpg',

View File

@ -1,5 +1,5 @@
var fs = require("fs") var fs = require("fs")
module.exports = function(s,config,lang){ module.exports = function(s,config,lang,getSnapshot){
const { const {
getEventBasedRecordingUponCompletion, getEventBasedRecordingUponCompletion,
} = require('../events/utils.js')(s,config,lang) } = require('../events/utils.js')(s,config,lang)
@ -87,13 +87,7 @@ module.exports = function(s,config,lang){
],d.ke) ],d.ke)
} }
} }
d.screenshotBuffer = d.screenshotBuffer || d.frame await getSnapshot(d,monitorConfig)
if(!d.screenshotBuffer){
const { screenShot, isStaticFile } = await s.getRawSnapshotFromMonitor(monitorConfig,{
secondsInward: monitorConfig.details.snap_seconds_inward
})
d.screenshotBuffer = screenShot
}
if(d.screenshotBuffer){ if(d.screenshotBuffer){
sendMessage({ sendMessage({
title: lang.Event+' - '+d.screenshotName, title: lang.Event+' - '+d.screenshotName,