make pausing kill obs recording

This commit is contained in:
2023-07-03 09:11:53 -06:00
parent 0ed1298855
commit 8e5d217532
2 changed files with 30 additions and 22 deletions

View File

@@ -63,13 +63,7 @@
(set lastInstructionPointer -2)
(collectedBlocks cleanup))
(doCleanup)
(#when debug
(when obsIsRecording
// kill the obs process
(case (Sys.systemName)
("Linux"
(assertProcess "kill" [(assertProcess "pgrep" ["obs"])]))
(otherwise (throw "OBS executable not defined for $(Sys.systemName)")))))
(when onComplete
(onComplete))
}))
@@ -85,20 +79,23 @@
profileDir "${projectObsFolder}/${os}_Profile"
sceneCollectionFile "${projectObsFolder}/${os}_SceneCollection.json"]
(if (and (sys.FileSystem.exists profileDir) (sys.FileSystem.exists sceneCollectionFile))
(new sys.io.Process
(case os
("Linux" "obs")
(otherwise (throw "OBS executable not defined for ${os}")))
[
"--profile"
profileDir
"--collection"
sceneCollectionFile
"--scene"
"Scene"
"--startrecording"
"--minimize-to-tray"
"--multi"
])
{
(new sys.io.Process
(case os
("Linux" "obs")
(otherwise (throw "OBS executable not defined for ${os}")))
[
"--profile"
profileDir
"--collection"
sceneCollectionFile
"--scene"
"Scene"
"--startrecording"
"--minimize-to-tray"
"--multi"
])
(set obsIsRecording true)
}
(print "OBS profile and scene collection not found for ${os} in ${projectObsFolder}. Will not be recording"))))))
(end)))

View File

@@ -187,11 +187,22 @@
(prop &mut :String projectObsFolder null)
(prop &mut :Bool obsIsRecording false))
(method stopObs []
(#when debug
(when obsIsRecording
// kill the obs process
(case (Sys.systemName)
("Linux"
(doFor id (.split (assertProcess "pgrep" ["obs"]) "\n")
(assertProcess "kill" [id])))
(otherwise (throw "OBS executable not defined for $(Sys.systemName)"))))))
(prop &mut :Bool paused false)
(prop &mut :Continuation onComplete null)
(method pause []
(unless paused
(stopObs)
(TimerWithPause.pause)
(set paused true)
(director.pause)))