use kiss_tools.OBSTools

This commit is contained in:
2023-07-30 12:07:08 -06:00
parent bbc3201154
commit 6d5e1392a6
3 changed files with 35 additions and 46 deletions

View File

@@ -1,4 +1,4 @@
# @install: lix --silent download "gh://github.com/kiss-lang/kiss-tools#1721220afa4ba7b388b8cdf240af08dec51d2ad3" into kiss-tools/0.0.0/github/1721220afa4ba7b388b8cdf240af08dec51d2ad3 # @install: lix --silent download "gh://github.com/kiss-lang/kiss-tools#7418d158fefe2e145006468f35c9fa0fed8c224c" into kiss-tools/0.0.0/github/7418d158fefe2e145006468f35c9fa0fed8c224c
-lib kiss -lib kiss
-cp ${HAXE_LIBCACHE}/kiss-tools/0.0.0/github/1721220afa4ba7b388b8cdf240af08dec51d2ad3/src/ -cp ${HAXE_LIBCACHE}/kiss-tools/0.0.0/github/7418d158fefe2e145006468f35c9fa0fed8c224c/src/
-D kiss-tools=0.0.0 -D kiss-tools=0.0.0

View File

@@ -61,7 +61,10 @@
(set isLoading false) (set isLoading false)
(.start (director.shortcutHandler)) (.start (director.shortcutHandler))
(director.hideTitleCard) (director.hideTitleCard)
(cc)))))) // When all loading is done, prompt to start obs recording automatically:
(#if debug
(promptToRecord cc)
(cc)))))))
(method doCleanup [] (method doCleanup []
(director.cleanup) (director.cleanup)
(set lastInstructionPointer -2) (set lastInstructionPointer -2)
@@ -72,7 +75,10 @@
(onComplete)) (onComplete))
})) }))
(defReaderMacro &bof "" [stream] `(#when (StringTools.contains kissFile className) (doPreload cc))) (defReaderMacro &bof "" [stream]
`(#when
(StringTools.contains kissFile className)
(doPreload cc)))
(defReaderMacro &eof "" [stream] (defReaderMacro &eof "" [stream]
`(#when (StringTools.contains kissFile className) `(#when (StringTools.contains kissFile className)
@@ -84,31 +90,8 @@
(dictSet v "TowardsPosition" hollywoo.Director.StageFacing.TowardsPosition) (dictSet v "TowardsPosition" hollywoo.Director.StageFacing.TowardsPosition)
(dictSet v "AwayFromPosition" hollywoo.Director.StageFacing.AwayFromPosition))) (dictSet v "AwayFromPosition" hollywoo.Director.StageFacing.AwayFromPosition)))
// When all loading is done, start obs recording automatically: (cleanup
(#when debug (#when debug
(preload (stopPromptedRecording)))
(when projectObsFolder
(let [os (Sys.systemName)
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"
])
(set obsIsRecording true)
}
(print "OBS profile and scene collection not found for ${os} in ${projectObsFolder}. Will not be recording"))))))
(end))) (end)))

View File

@@ -196,26 +196,11 @@
(director.showProp p.prop p.position ReAppearance .camera (_currentScene) cc) (director.showProp p.prop p.position ReAppearance .camera (_currentScene) cc)
cc)))))) cc))))))
(#when debug
(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 (reverse (.split (assertProcess "pgrep" ["obs"]) "\n"))
(assertProcess "kill" [id])))
(otherwise (throw "OBS executable not defined for $(Sys.systemName)"))))))
(prop &mut :Bool paused false) (prop &mut :Bool paused false)
(prop &mut :Continuation onComplete null) (prop &mut :Continuation onComplete null)
(method pause [] (method pause []
(unless paused (unless paused
(stopObs)
(TimerWithPause.pause) (TimerWithPause.pause)
(set paused true) (set paused true)
(director.pause))) (director.pause)))
@@ -226,6 +211,27 @@
(director.resume) (director.resume)
(TimerWithPause.resume))) (TimerWithPause.resume)))
(prop &mut promptedRecording false)
(method promptToRecord [:Continuation cc]
(unless kiss_tools.OBSTools.obsIsRecording
(director.chooseString
"Start recording?"
["Yes" "No"]
->:Void choice
(case choice
("Yes"
(set promptedRecording true)
(kiss_tools.OBSTools.startObs)
(cc))
(otherwise (cc))))))
(method stopPromptedRecording []
(set promptedRecording (and promptedRecording kiss_tools.OBSTools.obsIsRecording))
(when promptedRecording
(kiss_tools.OBSTools.stopObs)
(set promptedRecording false)))
(prop :Map<String,Array<String>> positionsInScene (new Map)) (prop :Map<String,Array<String>> positionsInScene (new Map))
(method resolvePosition [:Dynamic position] (method resolvePosition [:Dynamic position]
(typeCase [position] (typeCase [position]