From 8e5d217532bd99224236b1bbf6c162b9977dc8bb Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Mon, 3 Jul 2023 09:11:53 -0600 Subject: [PATCH] make pausing kill obs recording --- src/hollywoo/HollywooDSL.kiss | 41 ++++++++++++++++------------------- src/hollywoo/Movie.kiss | 11 ++++++++++ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/hollywoo/HollywooDSL.kiss b/src/hollywoo/HollywooDSL.kiss index 5e401fd..63ffd4f 100644 --- a/src/hollywoo/HollywooDSL.kiss +++ b/src/hollywoo/HollywooDSL.kiss @@ -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))) \ No newline at end of file diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index dc80f7a..38c892c 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -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)))