From e42019cd38b59e757f6036b132614a471d4cf6fe Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Wed, 2 Aug 2023 22:23:48 +0200 Subject: Adds configure support for URLs --- Captura/Scripting/ConfigureCommand.swift | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Captura/Scripting/ConfigureCommand.swift (limited to 'Captura/Scripting/ConfigureCommand.swift') diff --git a/Captura/Scripting/ConfigureCommand.swift b/Captura/Scripting/ConfigureCommand.swift new file mode 100644 index 0000000..4e42326 --- /dev/null +++ b/Captura/Scripting/ConfigureCommand.swift @@ -0,0 +1,33 @@ +import Foundation + +@objc(ConfigureCommand) +class ConfigureCommand: NSScriptCommand { + override func performDefaultImplementation() -> Any? { + + let args = self.directParameter as? [String: Any] ?? [:] + + // Here you can extract the parameters from the args dictionary and configure your settings + let fps = args["fps"] as? Int + let outputs = OutputFormatSetting(args["outputs"] as? String ?? "") + let backend = URL(string: args["backend"] as? String ?? "") + let backendOutput = OutputFormatSetting(args["backend_output"] as? String ?? "") + let keepLocalFiles = args["keep_local_files"] as? Bool + + let config = ConfigureAction( + action: "configure", + fps: fps, + outputs: outputs, + backend: backend, + backendOutput: backendOutput, + keepLocalFiles: keepLocalFiles + ) + + NotificationCenter.default.post(name: .setConfiguration, object: nil, userInfo: [ + "config": config + ]) + NotificationCenter.default.post(name: .reloadConfiguration, object: nil, userInfo: nil) + + // Return a result if needed + return nil + } +} -- cgit