aboutsummaryrefslogtreecommitdiff
path: root/Captura/Scripting/ConfigureCommand.swift
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2023-08-02 22:23:48 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2023-08-02 22:23:48 +0200
commite42019cd38b59e757f6036b132614a471d4cf6fe (patch)
tree2c95f67640d01a63ef9696ec23d429b866d87293 /Captura/Scripting/ConfigureCommand.swift
parent153f3309127a4f9d898310224a467d11eef0f2ff (diff)
Adds configure support for URLs
Diffstat (limited to 'Captura/Scripting/ConfigureCommand.swift')
-rw-r--r--Captura/Scripting/ConfigureCommand.swift33
1 files changed, 33 insertions, 0 deletions
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
+ }
+}