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": {

View File

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

View File

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

View File

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

View File

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