]>
Commit | Line | Data |
---|---|---|
1 | import Foundation | |
2 | ||
3 | @objc(ConfigureCommand) | |
4 | class ConfigureCommand: NSScriptCommand { | |
5 | override func performDefaultImplementation() -> Any? { | |
6 | ||
7 | let args = self.directParameter as? [String: Any] ?? [:] | |
8 | ||
9 | // Here you can extract the parameters from the args dictionary and configure your settings | |
10 | let fps = args["fps"] as? Int | |
11 | let outputs = OutputFormatSetting(args["outputs"] as? String ?? "") | |
12 | let backend = URL(string: args["backend"] as? String ?? "") | |
13 | let backendOutput = OutputFormatSetting(args["backend_output"] as? String ?? "") | |
14 | let keepLocalFiles = args["keep_local_files"] as? Bool | |
15 | ||
16 | let config = ConfigureAction( | |
17 | action: "configure", | |
18 | fps: fps, | |
19 | outputs: outputs, | |
20 | backend: backend, | |
21 | backendOutput: backendOutput, | |
22 | keepLocalFiles: keepLocalFiles | |
23 | ) | |
24 | ||
25 | NotificationCenter.default.post(name: .setConfiguration, object: nil, userInfo: [ | |
26 | "config": config | |
27 | ]) | |
28 | NotificationCenter.default.post(name: .reloadConfiguration, object: nil, userInfo: nil) | |
29 | ||
30 | // Return a result if needed | |
31 | return nil | |
32 | } | |
33 | } |